You are on page 1of 1

/*

* To change this template, choose Tools | Templates


* and open the template in the editor.
*/
package IfElseLabs2;
import java.util.Scanner;
/**
*
* @author Guest
*/
public class Pressure3 {
public static void main(String[] args) {
Scanner reader = new Scanner(System.in);
boolean goodPressure = true;
System.out.print("Input right front pressure: ");
int rightFront = reader.nextInt();
if(rightFront < 35 || rightFront > 45){
System.out.println("Warning: pressure is out of range");
goodPressure = false;
}
System.out.print("Input left front pressure: ");
int leftFront = reader.nextInt();
if(leftFront < 35 || leftFront > 45){
System.out.println("Warning: pressure is out of range");
goodPressure = false;
}
System.out.print("Input right rear pressure: ");
int rightRear = reader.nextInt();
if(rightRear < 35 || rightRear > 45){
System.out.println("Warning: pressure is out of range");
goodPressure = false;
}
System.out.print("Input left rear pressure: ");
int leftRear = reader.nextInt();
if(leftRear < 35 || leftRear > 45){
System.out.println("Warning: pressure is out of range");
goodPressure = false;
}
if( ((rightFront - leftFront <= 3) && (rightFront - leftFront >= 0)) ||
((leftFront - rightFront <=3) && (leftFront - rightFront >=0)) && (goodPressure
== true)){
System.out.println("Inflation is OK");
}
else{
System.out.println("Inflation is not OK");
}
}
}

You might also like