Starting from:
$30

$24

Create a Java Class named Automobile Solution

This class should contain private member variables for the description, odometer, current speed, current gear, and public methods to access and change the values of these variables. The class should also contain a method called display(), this method should print the status of the car.

The driver (main method) for this class should create at least 2 automobile objects, populate their data members and then call the display method for each car.

Class Automobile
-description:String
-odometer: int
-speed: int
-gear: char

+setDescription(String)
+getDescription(): String
+setOdometer(int)
+getOdometer(): int
+setSpeed(int)
+getSpeed(): int
+setGear(char)
+getGear(): char
+display()

Example:
You have the following cars:
Description: Ford GT400
Odometer: 2600 miles
Speed: 79mph
Gear: 3

Description: Toyota Prius
Odometer: 147928 miles
Speed: 62mph
Gear: D

More products