I need a pseudocode lit Creates an object of the nd prompts the user to enter th
ID: 3920173 • Letter: I
Question
I need a pseudocode
lit Creates an object of the nd prompts the user to enter the name, type, and age of his or her pet. Th uld be stored in the object. Use the object's accessor methods to renieve name, type, and age and display this data on the screen. the pet's name, ty 2. car Class Deig a dlas named caetillonine i e1: The yearModel field is an Integer that holds the car's year model. arModel: ye make: The make field references a String that holds the make of the car. Speed: The speed field is an integer that holds the car's current speed. e , · In addition, the class should have the following constructor and other methods . Constructor: The constructor should accept the car's year model and make as arguments. These values should be assigned to the object's yearModel and fields. The constructor should also assign 0 to the speed field.Explanation / Answer
class Cars
int yearModel
string make
int speed
Cars (int aYearModel, string aMake, int aSpeed = 0)
yearModel = aYearModel
make = aMake
speed = aSpeed
void setYearModel(int aYearModel)
yearModel = aYearModel
return
void setMake(string aMake)
make = aMake
return
void setSpeed(int speed)
speed = aSpeed
return
int getYearModel()
return yearModel
string getMake()
return make
int getSpeed()
return speed
void accelerate(void)
speed += 5
void break()
speed -= 5
main()
Cars obj1(2018, "tata", 180)
obj1.accelerate()
print return from getSpeed()
obj1.accelerate()
print return from getSpeed()
obj1.accelerate()
print return from getSpeed()
obj1.accelerate()
print return from getSpeed()
obj1.accelerate()
print return from getSpeed()
obj1.break()
print return from getSpeed()
obj1.break()
print return from getSpeed()
obj1.break()
print return from getSpeed()
obj1.break()
print return from getSpeed()
obj1.break()
print return from getSpeed()
print "current speed " return grom getSpeed()
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.