0

I have to have the tire pressure of the two back wheels the same and the two back wheels the same but it doesnt seem to be working.

public class Pressure
{
	private int fr;
	private int fl;
	private int br;
	private int bl;
	
	public Pressure()
	{
		
	}
	public void getPressure()
	{
		if(fr == fl && br==bl)
			System.out.println("Your tire pressure is ok.");
		else
			
			System.out.println("Your tire pressure is not ok.");
	
	
	}
}
import java.util.Scanner;
	public class PressureTester
	{
		public static void main(String[]args)
		{
		Scanner in = new Scanner(System.in);
		
		System.out.println("Pressure of Front Right tire.");
		int fr = in.nextInt();
		
		System.out.println("Pressure of Front Left tire.");
		int fl = in.nextInt();
		
		System.out.println("Pressure of Back Right tire.");
		int br = in.nextInt();
		
		System.out.println("Pressure of Back Left tire.");
		int bl = in.nextInt();
		
		Pressure set1 = new Pressure();
		
		System.out.println(set1.getPressure());
		
		
		
		
		}
	}
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by BestJewSinceJC
0

You have to pass your tire pressures as parameters to the constructor. You also have to modify your constructor so that it will take the parameters, and you also have to set your Pressure class's instance variables to the values you pass in when you call the constructor.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.