1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
makkiz [27]
3 years ago
7

Create a class Car, which contains Three data members i.e. carName (of string type), ignition (of bool type), and currentSpeed (

of integer type)
 A no-argument constructor to initialize all data members with default values
 A parameterized constructor to initialize all data members with user-defined values
 Three setter functions to set values for all data members individually
 Three getter function to get value of all data members individually
 A member function setSpeed( ) // takes integer argument for setting speed
Derive a class named Convertible that contains
 A data member top (of Boolean type)
 A no-argument constructor to assign default value as “false” to top
 A four argument constructor to assign values to all data-members i.e. carName, ignition, currentSpeed and top.
 A setter to set the top data member up
 A function named show() that displays all data member values of invoking object
Write a main() function that instantiates objects of Convertible class and test the functionality of all its member functions.
Computers and Technology
1 answer:
olasank [31]3 years ago
4 0

Answer:

Copy paste it.

Explanation:

#include <iostream>

#include <string>

using namespace std;

//Create a class Car, which contains • Three data members i.e. carName (of string type), ignition (of bool type), and //currentSpeed (of integer type)

class Car

{

public:

string carName;

bool ignition;

int currentSpeed;

//A no-argument constructor to initialize all data members with default values

//default value of string is "",bool is false,int is 0

Car()

{

carName="";

ignition=false;

currentSpeed=0;

}

//A parameterized constructor to initialize all data members with user-defined values

Car(string name,bool i,int speed)

{

carName=name;

ignition=i;

currentSpeed=speed;

}

//Three setter functions to set values for all data members individually

// Three getter function to get value of all data members individually

void setCarName(string s)

{

carName=s;

}

void setIgnition(bool ig)

{

ignition=ig;

}

void setCurrentSpeed(int speed)

{

currentSpeed=speed;

}

string getCarName()

{

return carName;

}

bool getIgnition()

{

return ignition;

}

int getCurrentSpeed()

{

return currentSpeed;

}

//A member function setSpeed( ) // takes integer argument for setting speed

void setSpeed(int sp1)

{

currentSpeed=sp1;

}

};

//Derive a class named Convertible

class Convertible:public Car

{

//A data member top (of Boolean type)

public:

bool top;

public:

//A no-argument constructor to assign default value as “false” to top

Convertible()

{

top=false;

}

//A four argument constructor to assign values to all data-members i.e. carName, ignition,

//currentSpeed and top.

Convertible(string n,bool i,int s,bool t):Car(n,i,s)

{

carName=n;

ignition=i;

currentSpeed=s;

top=t;

}

// A setter to set the top data member up

void setTop(bool t)

{

top=t;

}

//A function named show() that displays all data member values of invoking object

void show()

{

cout<<"Car name is:"<<carName<<endl;

cout<<"Ignition is: "<<ignition<<endl;

cout<<"Current Speed is :"<<currentSpeed<<endl;

cout<<"Top is:"<<top<<endl;

}

};

//main function

int main()

{

//creating object for Convertible class

Convertible c1("Audi",true,100,true);

c1.show();

c1.setCarName("Benz");

c1.setIgnition(true);

c1.setCurrentSpeed(80);

c1.setTop(true);

c1.show();

cout<<"Car Name is: "<<c1.getCarName()<<endl;

cout<<"Ignition is:"<<c1.getIgnition()<<endl;

cout<<"Current Speed is:"<<c1.getCurrentSpeed()<<endl;

return 0;

}

You might be interested in
Compare the freedom available to the American media with the freedom available to media in other parts of the world. How does a
Rzqust [24]

in america we are free to say most of whatever we want in media becuase we have free speech here. in other countries, they don't have freedom of speech,and sometimes it also has to do with the political situation. like say in china, where teenagers arent allowed to use the internet for more than a certain amount of time,and arent allowed to talk to each other. thats becuase of the fact that that country is a communist country and the government wants much more control than in other countries.

6 0
2 years ago
The stream cipher described in Definition 2.1.1 can easily be generalized to work in alphabets other than the binary one. For ma
Free_Kalibri [48]

Answer:

Check the explanation

Explanation:

1) supposing the keystream is a stream that is of random bits in Z26, we can describe a stream cipher based on the Latin Alphabet that is as follows (where A ↔ 0, B ↔ 1, C ↔ 2 etc):

y_{i} =x_{i} +k_{i} mod26

x_{i} =y_{i} -k_{i} mod26

2)

x_{i} =y_{i} -k_{i} = ” B ” − ” R ” = 1 − 17 = − 16 ≡ 10 mod 26 = ” K ” etc ·

The Decrypted Text is: ”KASPAR HAUSER”

8 0
3 years ago
What Word feature is seen below?
nika2105 [10]

hi there


!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!





<em><u>it c the ribbon tab. just want  to help .</u></em>





!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


hope this helps. if you want please mark brainlyist. enjoy





3 0
2 years ago
If you want to conserve ink or toner, you can instruct PowerPoint to print ____ documents.
kondor19780726 [428]
I believe the answer would be Draft Quality. (300x300 resolution).

5 0
3 years ago
If you want to adjust the width of a column manually, move your mouse over the _______ column boundary and click and drag until
Luda [366]

Answer:

The answer is "Right".

Explanation:

In computer science, editing is the primary activity, which is used by the users to handles graphics, tables, and other things. It can be divided into two types first is internal(default) and the second is manual.

  • In the manual editing, to edit the column of the table we just right click on the column.
  • It enables you to edit option, in which we edit column according to our desire.
6 0
3 years ago
Other questions:
  • Sam wanted to open a file that he saved yesterday. Which component inside the computer stores this file? the hard drive the fax
    13·2 answers
  • To generate a report with exact results based on specific criteria it is best to base the report on a(n) ____________________ cr
    6·1 answer
  • Businesses use spreadsheets to keep track of financial________.
    14·1 answer
  • What is qwerty and why is it on the keyboard?
    15·2 answers
  • How do you calculate the total resistance in a series circuit with more than one resistor?
    9·1 answer
  • Simplify 0.2×0.03055 to 3 decimal places​
    15·2 answers
  • Type the correct answer in each box. Spell all words correctly.
    14·2 answers
  • 1) It is possible to email a document<br> directly from the Word application.<br> O FALSE<br> O TRUE
    10·1 answer
  • 1- pensamiento sistémico<br>2- visión oriental y occidental​
    8·1 answer
  • Task 2
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!