Write a complete Java program that makes sure that the tire pressures match. The
ID: 3627643 • Letter: W
Question
Write a complete Java program that makes sure that the tire pressures match. The front tires of a car should have the same pressure and same with the rear tires (but not necessarily the same pressure as the front).Your program should read in the pressure of the four tires and writes a message that says if the pressures are good or not.
Your program should make sure that the input pressures are within the range: 30 – 40, inclusive. If invalid pressures are entered, alert the user and discard the input, and ask again for input. This validation should continue till the user enters valid pressures for all 4 tires.
Explanation / Answer
import java.io.*; public class TirePressure{ public static int[] pressures = new int[4]; //frontLeftTire, frontRightTire, backLeftTire, backRightTire public static String[] tires = {"front left","front right","back left","back right"}; public static boolean validPressure(int pressure){ if((pressure >= 30) && (pressureRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.