Skip to content

Instantly share code, notes, and snippets.

@pepet96
Created November 13, 2013 23:57
Show Gist options
  • Save pepet96/7458751 to your computer and use it in GitHub Desktop.
Save pepet96/7458751 to your computer and use it in GitHub Desktop.
import java.util.Scanner;
public class MoreTirePressure {
public static void main (String [] args) {
Scanner input = new Scanner(System.in);
System.out.println("Pressure of the right front tire: ");
double rf = input.nextDouble();
System.out.println("Pressure of the left front tire: ");
double lf = input.nextDouble();
System.out.println("Pressure of the right rear tire: ");
double rr = input.nextDouble();
System.out.println("Pressure of the left rear tire: ");
double lr = input.nextDouble();
if (rf == lf && 35 <= rf && rf <= 45) System.out.println("Tire pressure in your front tires is ok.");
else if (rf == lf && (rf < 35 || rf > 45)) System.out.println("Tire pressure in front tires is out of range, inflation is bad");
else System.out.println("Tire pressure in your front tires is not ok.");
if (rr == lr && 35 <= rr && rr <= 45) System.out.println("Tire pressure in your rear tires is ok.");
else if (rr == lr && (rr < 35 || rr > 45)) System.out.println("Tire pressure in rear tires is out of range, inflation is bad");
else System.out.println("Tire pressure in your rear tires is not ok.");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment