Question: aS 166 Quiz 1 (Chapters 1-3) Pragram y(20 points) Write a class Car that has the following fields: make holds the make of the car,
aS 166 Quiz 1 (Chapters 1-3) Pragram y(20 points) Write a class Car that has the following fields: make holds the make of the car, such as "Ford", "Honda" etc... . speed " xsarMedel: a whole number that holds the car's year model speed: a whole number that represents the car's current speed. The class Car should have the following methods. Constructor Shouldaccept the car's year model and the make arguments. These values should be assigned to the object's yearModel and make fields. The constructor should also speed to be zero initialize the Accessors: Create accessor methods to yearModel, make, and the speed fields. acelerate:The accelerate method should add 5 to the speed field Should subtract S from the speed field each time it is called
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
