Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

USE C++ program Assignment - Single Class You will be creating a Car class in this assignment. So, how do we describe a car? model,

image text in transcribed
image text in transcribed
image text in transcribed
USE C++ program Assignment - Single Class 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 o.) 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 ordecelerates a negative integer. However, speed should not be less than Pese create some driver code in main function calls to some of the methods such as to instantiate some car objects and make Olie A A A Aa Ao EEE x Al AEEE S AL. AaBbCcDi AaBbc 1 Normal 1 No Sp. . Paragraph Assignment - Single Class 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 ignment - Saved to this PC Search out References Mailings Review View Help 4. Aav A EVEVE EE LT APA AaBbCcDi AaBbCcDi AaBb Cc AaBbc 1 Normal No Spac. Heading 1 Heading Paragraph Styles Suning Tune; 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 o.) 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. o Focus

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Marketing Database Analytics

Authors: Andrew D. Banasiewicz

1st Edition

0415657881, 978-0415657884

More Books

Students also viewed these Databases questions

Question

Write a Python program to check an input number is prime or not.

Answered: 1 week ago

Question

How would we like to see ourselves?

Answered: 1 week ago