Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

*I just need \" Flowchart\" and \" Pseudo code \" for this problem*: 2. Car Clas

ID: 3888763 • Letter: #

Question

*I just need "Flowchart" and "Pseudo code" for this problem*:

2. Car Class Write a class named Car that has the following fields: yearMode1. The yearMode1 field is an int that holds the car's year model. make. The make field is a String object that holds the make of the car, such as "Ford “Chevrolet", "Honda", etc. speed. The speed field is an int that holds the car's current speed In addition, the class should have the following methods. Constructor. The constructor should accept the car's year model and make as argu ments. These values should be assigned to the object's yearModel and make fields. The constructor should also assign 0 to the speed field. Accessor. The appropriate accessor methods get the values stored in an object's yearModel, make, and speed fields. accelerate. The accelerate method should add 5 to the speed field each time it is called. brake. The brake method should subtract 5 from the speed field each time it is called. Demonstrate the class in a program that creates a Car object, and then calls the accelerate method five times. 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.

Explanation / Answer

Please find my answer:

class Car

Instance Variables:

//Declarations

private string yearModel

private string make

private double speed

Constructor:

Car (string year, string mk)

yearModel = year

make = mk

speed = 0

Accessors:

public string getYearModel()

return yearModel

public string getMake()

return make

public double getSpeed()

return speed

public void accelerate()

set speed = speed + 5

public void brake()

set speed = speed - 5

main():

create a Car Object:

Car car = new Car()

// calling 5 times accelerate

car.accelerate()

print car.getSpeed()

car.accelerate()

print car.getSpeed()

car.accelerate()

print car.getSpeed()

car.accelerate()

print car.getSpeed()

car.accelerate()

print car.getSpeed()

// calling brake 5 times

car.brake()

print car.getSpeed()

car.brake()

print car.getSpeed()

car.brake()

print car.getSpeed()

car.brake()

print car.getSpeed()

car.brake()

print car.getSpeed()

return

endClass