It210 m4a1 programming assignment - program along with a


This activity will enable you to apply what you will learn during this course.

You need to write a program for the instructions given below:

Create an Automobile class for a dealership. Include fields for an ID number, make, model, color, year, vin number, miles per gallon, and speed. Include get and set methods for each field. Do not allow the ID to be negative or more than 9999; if it is, set the ID to 0. Do not allow the year to be earlier than 2000 or later than 2017; if it is, set the year to 0. Do not allow the miles per gallon to be less than 10 or more than 60; if it is, set the miles per gallon to 0. Car speed should be initialized as 0. Include a constructor that accepts arguments for each field value and uses the set methods to assign the values. Also write two methods, Accelerate () and Brake (). Whenever Accelerate () is called, increase the speed by 5, and whenever Brake () is called, decrease the speed by 5. To allow users to specify the speed to increase (or decrease), create two overloading methods for Accelerate () and Brake () that accept a single parameter specifying the increasing (or decreasing) speed. Write an application that declares several Automobile objects and demonstrates that all the methods work correctly. Save the files as Automobile.java and TestAutomobiles.java.

Please submit the source code for your program along with a word document that includes screen shots of the compiled results and executed output. The page margins on the top, bottom, left side, and right side should be 1 inch each.

Solution Preview :

Prepared by a verified Expert
JAVA Programming: It210 m4a1 programming assignment - program along with a
Reference No:- TGS02867597

Now Priced at $30 (50% Discount)

Recommended (95%)

Rated (4.7/5)