Design a class named car that has the following fields:
yearModel: The yearModel field is an Integer that holds the car’syear model.
make; The make field references a string that holds the make of thecar
speed: The speed field is an Integer that holds the car’s currentspeed.
In addition, the class should have the following constructor andother methods:
Constructor: The constructor should accept the car’s year model andmake as arguments. These values should be assigned to the object’syearModel and make fields. The constructor should also assign 0 tothe speed field.
Accessors: Design appropriate accessor methods to get the valuesstored in an object’s yearModel, make, and speed fields.
accelerate: The accelerate method should add 5 to the speed fieldeach time it is called.
brake: The brake method should subtract 5 from the speed field eachtime it is called.
Next, design a program that creates a car object, and then callsthe accelerate method five times. After each call to the acceleratemethod, get the current speed of the car and display it. Then callthe brake method five times. After each call to the brake method,get the current speed of the car and display it.





