Question: Create a class that represents a real life object (in our case an automobile) Implement the class as specified in the UML class diagram Declare

Create a class that represents a real life object (in our case an automobile)
Implement the class as specified in the UML class diagram
Declare getters to provide read-access for fields
Implement a parameterized constructor to initialize the fields
Develop an algorithm to calculate the desired result
Use the newly created class as type of local variables
Description: Create a jGrasp project called Auto that includes two java files: Automobile.java and AutomobileApp.java Each java file should include a block comment on top that lists the author and a brief description of the class. Automobile.java: Implement the class Automobile as specified in the UML class diagram above. The class name, method names, parameter lists, and return types need to match the UML class diagram.
Important: No fields, public methods, or constructors should be added nor modified. Include the three comments // fields, // constructors, and // methods to group the constructor(s) and class members.
Use access modifiers as indicated by the + and next to the field, constructor, and method names. Notice that the class has no mutators. This is a deliberate design decision. No setters should be added.
Method getLiterPer100km Miles per gallon is a great way to measure fuel efficiency in the United States. However, many countries use the metric system instead. In Germany for example fuel efficiency is measured in liters per 100 km. Notice that there is no corresponding field for the method literPer100k. The value needs to be calculated based on the miles per gallon. (A good opportunity to refresh and apply your math skills) AutomobileApp.java Class AutomobileApp does not represent a real life object. It includes the main method and it is a test client for class Automobile. In order to test the class Automobile do the following:
Create three instances (objects) of type Automobile and assign each to a variable. The instances should be an Audi A4, a Honda Accord, and a Cadillac CTS. The A4 uses 26 mpg, the Accord 31 mpg, and the CTS 21 mpg.
Display the information of the automobiles as shown in the output. Make sure that the information displayed was accessed through the Automobile instance. Hint: youll need to find a way to access the field values. Use format specifiers to produce the columns. Notice that the names are left aligned while the fuel efficiency is right aligned. Notice also that the display of the fuel efficiency is rounded to 2 digits. Caveat: The rounding is a requirement of the test client. Class Automobile needs to return the results in full precision.
Automobile make String model: String mpg double Automobile make String, model String, mpg double) getMake String getModel String get Mpg double liter Per100km double
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
