subject

Design a class named Car that has the following fields:
year Model: an int instance variable that holds the car’s year model.
make: a string instance variable that holds the make of the car.
speed: an int instance variable that holds the car’s current speed.
In addition, the class should have the following methods.
Constructor 1: no-arg constructor set the yearModel, make and speed to 2000, Nissan and 4, respectively.
Constructor 2: this is an overloaded constructor. This constructor should accept the car’s year model, speed, and make as arguments. These values should be assigned to the object’s yearModel, speed and make fields.
Accessor (getters): appropriate accessor methods to get the values stored in an object’s yearModel, make, and speed fields.
Mutator (setters): appropriate mutator methods to store values in an object’s yearModel, make, and speed fields.
toString: returns a string describing the object’s yearModel, make and speed.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:00
Technician a says that the radiator usually cools better if the front air dam is removed. technician b says that when a condenser has a leak it can be repaired easily with epoxy. who is correct?
Answers: 1
question
Computers and Technology, 22.06.2019 22:00
Perform the following tasks: a. create a class named testclass that holds a single private integer field and a public constructor. the only statement in the constructor is one that displays the message “constructing”. write a main()function that instantiates one object of the testclass. save the file as testclass.cpp in the chapter 08 folder. run the program and observe the results. b. write another main()function that instantiates an array of 10 testclass objects. save the file as test class array.c . run this program and observe the results.
Answers: 1
question
Computers and Technology, 23.06.2019 00:00
How do we use the sumif formula (when dealing with different formats) ?
Answers: 1
question
Computers and Technology, 23.06.2019 03:30
Hashtags serve to identify the topic of a given tweet true false
Answers: 2
You know the right answer?
Design a class named Car that has the following fields:
year Model: an int instance variable t...
Questions
Questions on the website: 13722367