Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part 1: Design a Class Youll design a class named Car that has the following fields: yearModelAn Integer that holds the cars model year makeA

Part 1: 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 year model and make fields.

The constructor should also assign 0 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 5 to the speed field each time its called.

The brake method should subtract 5 from the speed field each time its called.

Create your class in a plain-text editor such as Notepad or TextEdit and save as a text file (*.txt).

Part 2: 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.

Write your pseudocode in a plain-text 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.

Take a screenshot of the results after your fifth time calling the method, and save it as a JPEG file (*.jpg).

Then, call the brake method five times. After each call to the brake method, get the current speed of the car and display it.

Take a screenshot of the results after your fifth time calling the method, and save it as a JPEG file (*.jpg).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data And Databases

Authors: Jeff Mapua

1st Edition

1978502257, 978-1978502253

More Books

Students also viewed these Databases questions

Question

X (E,B) 3 (1ik jik Aj) X(w) = (X1(w), X(w), ..., Xk(w)).

Answered: 1 week ago

Question

LO3 Name the seven categories of HR functions.

Answered: 1 week ago