Question: You will be creating a Car class in this assignment. So, how do we describe a car? model, make, year, color, package, price... What does

 You will be creating a Car class in this assignment. So,

You will be creating a Car class in this assignment. So, how do we describe a car? model, make, year, color, package, price... What does a car do? drive, start, stop... Okay, now, let's create a simplified Car class based on the above descriptions 1. Create a class Car, which has the following member data and methods 1) Member variables Access specifier:private int year; string make; double price; int speed;//miles per hour 2) Member methods Access specifier: public a constructors Create a default constructor and initialize all member variables. The speed should be set to 0.) Create a parameterized constructor and set member variables with arguments passed over. The speed should be set to 0. b. getters and setters For each member variable, create a mutator function (setter) and an accessor function (getter), except for speed. Only create a getter method for speed variable. c. drive method The method takes one parameter: int accelerate_or_decelerate The method should update the member variable speed. If accelerate_or_decelerate is a positive integer, the speed gets increased by the value; otherwise, decreased, if accelerate_or_decelerate is a negative integer. However, speed should not be less than 0. 2. Please create some driver code in main(), such as to instantiate some Car objects and make function calls to some of their methods

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!