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
Vilka [71]
3 years ago
11

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:
prisoha [69]3 years ago
5 0

Answer:

Here.

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
Define the term<br>cyber culture​
PolarNik [594]

Answer:

The social conditions brought about by the widespread use of computer networks for communication, entertainment, and business.

Hope This Helps!!!!

Explanation:

8 0
3 years ago
What are the steps to insert an image into an email message place the steps in the correct order
AnnyKZ [126]

Answer:

How to insert photo into email?

Insert a picture into the body of an email message

To insert a picture that displays in the body of an email message, use the following steps: Position your cursor where you want the image in your message. Select Insert > Pictures. Browse your computer or online file locations for the picture you want to insert. I think this is helpful

8 0
3 years ago
Read 2 more answers
What I need to know is math please<br>​
tekilochka [14]

Answer:

huh

Explanation:

7 0
3 years ago
Read 2 more answers
The WAIS was designed for testing ________ intelligence, whereas the WISC was designed for testing ________ intelligence.
Blizzard [7]

Answer:

WAIS :Adult's and older adolescent's intelligence, WISC: Children's intelligence.

Explanation:

WAIS (Wechsler adult intelligence scale) is an IQ test designed by David Wechsler to measure the intelligence and cognitive skills of adults and older adolescents. The test was first published in 1955 as a revision of the 1939 Wechsler- Bellevue intelligence scale.

The WISC (Wechsler intelligence scale for children) was also created by David Wechsler and it is used to test the intelligence of children between the ages of 6 and 16.

8 0
3 years ago
How are computers located on a network
Luba_88 [7]

Answer:

<em>When computers connect on the same network, it is called a local area network, or LAN. </em>

Explanation:

<em>The router is given the IP address for your connection to the Internet and then assigns local IP addresses to each device in your network.</em>

<em />

<em>Hope this can help you </em>

8 0
3 years ago
Other questions:
  • After you use the fill handle to copy cell contents, the quick copy options button appears, which can be used to fill the cells
    5·1 answer
  • MinMax is a function that takes five arguments and returns no value. The first three arguments are of type int. The last two arg
    14·1 answer
  • AI vs IA like the difference
    12·2 answers
  • There was a software crisis in 1968, as result of programming abilities, due to the invention of integrated circuits (chips).A.
    10·1 answer
  • C programming:
    13·1 answer
  • Why should ERP architecture include a discussion on organizational structure, business processes, and people, instead of just in
    5·1 answer
  • If you convinced your teacher to give you an extension on an assignment, what would this situation be an example of? OA. General
    8·1 answer
  • Choose two technologies that you think would help the company meet its goals. Then fill in the chart below to compare the techno
    11·2 answers
  • TRUE OR FALSE: COMPUTER SCIENCE!
    8·2 answers
  • Suppose you have a string matching algorithm that can take in (linear)strings S and T and determine if S is a substring (contigu
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!