Question: Instructions Part 1 : Design a Class You ll design a class named Car that has the following fields: yearModel An Integer that holds the
Instructions
Part : Design a Class
Youll design a class named Car that has the following fields:
yearModelAn Integer that holds the cars model year
makeA String that holds the make of the car
speedAn Integer that holds the cars current speed
The class should have the following constructor and other methods:
The constructor should accept the cars model year and make as arguments. These values should be assigned to the objects yearModel and make fields. The constructor should also assign to the speed field.
Design appropriate accessor methods to get the values stored in an objects yearModel, make, and speed fields.
The accelerate method should add to the speed field each time its called.
The brake method should subtract from the speed field each time its called.
Create your class in a plaintext editor such as Notepad or TextEdit and save as a text file txt
Part : Design a Program
Youll create both pseudocode and a flowchart to design a program that creates a Car object and then calls the accelerate method five times.
Review Appendices B and C in your textbook for guidance when working on your project. Use the programs listed in Graded Project to create the flowchart. Write your pseudocode in a plaintext editor such as Notepad or TextEdit and save as a text file txt Also, save a screenshot of your flowchart as a JPEG file jpg
After each call to the accelerate method, get the current speed of the car and display it
Then, call the brake method five times. After each call to the brake method, get the current speed of the car and display it
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
