0
public class CarTester {
	
	public static void main (String[] args)
	{
		Car myMysteryMachine = new Car (1000); // Car gets 1000 miles per gallon
		myMysteryMachine.addGas(20); // 20 gallons of gas are added to the tank
		myMysteryMachine.drive(100); // Driving the car 100 miles
		System.out.println(myMysteryMachine.getGasInTank()); // Method prints the remaining fuel
		
	}
}

Edited by Ezzaral: Added code tags. Please use them to format any code that you post.

3
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by NormR1
0

its referring to the Car myMysteryMachine = new Car (1000); // Car gets 1000 miles per gallon

0

Have you declared a constructor Car(int) ?

When you get: "cannot find symbol" it is usually because you are using a method or class that doesn't exist.

Meaning that you either haven't imported the class or you are calling the method/constructor with the wrong arguments or return type, or you simply have misspelled the method/constructor.

Or just as the messages says that method/constructor (Car(int)) doesn't exists

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.