

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


public static void main(String[] args) { //Input any 3 integers Scanner input = new Scanner (System.in); System.out.print("Enter an integer -> "); int a = input.nextInt(); System.out.print("Enter an integer -> "); int b = input.nextInt(); System.out.print("Enter an integer -> "); int c = input.nextInt(); int max; if (a > b && a > c) max = a; else if (b > a && b > c) max = b; else max =c; System.out.println("Maximum of the input values is: "+ max); }
public static void main(String[] args) { Scanner input = new Scanner (System.in); System.out.print("Enter the Tire Pressure (0..75 psi) -> "); int pressure = input.nextInt(); System.out.print("Pressure: " + pressure + " psi : "); String state = "Pressure OK"; //30..35:OK //under 30 : UNDERinflated //over 35 : //OVERinflated if(state < 30) state = “UNDERinflated”; else if(state > 35) state = “OVERinflated”; }
public static void main(String[] args) { Scanner input = new Scanner (System.in); System.out.print("Enter a Positive Single Digit (0..9) -> "); int digit = input.nextInt(); int quotient = 0; switch (digit) { case 9 : case 8 : quotient++; case 7 : case 6 : quotient++; case 5 : case 4 : quotient++; case 3 : case 2 : quotient++; default: ; } System.out.println(digit + " / 2 = " + quotient); }