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
}
}
TigerTeck 0 Light Poster
TigerTeck 0 Light Poster
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster
NormR1 563 Posting Sage Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.