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
What is technology addiction​
Helen [10]

Answer:

What is the definition of technology addiction?

Technology addiction is defined as the uncontrollable overuse of technological devices including smart phones, computers, and gaming systems. ... Individuals suffering from technology addiction often display both behavioral and physical symptoms.

Explanation:

Technology addiction can be defined as frequent and obsessive technology-related behavior increasingly practiced despite negative consequences to the user of the technology. An over-dependence on tech can significantly impact students' lives.

5 0
3 years ago
True or false: the HTTPs means that the information on a website has been fact-checked
nevsk [136]

Answer:

False

Explanation:

4 0
3 years ago
Need help with this is photography :)
mestny [16]

Answer:

UV filter, This filter blocks UV light and removes the blue cast from images taken in very bright sunny conditions. ... With old film cameras it was often necessary to use a UV filter because film is extremely sensitive to UV light.

8 0
3 years ago
A data __________ is trained in both computer science and statistics and knows how to effectively process and analyze large amou
Inga [223]

Answer: data scientist

Explanation:

3 0
3 years ago
Please briefly describe your QA / testing process?
gtnhenbr [62]

Answer: The QA/Testing process consist of the following:

1. Requirement specification

2. Reviewing the code.

3. Unit testing

4. Integration test

5. Performance testing

Explanation:

We start of by the requirement specification try to gather all the information accurately. Then begins the coding process where there is review of the code so that they perform their desired purpose. After modules are completed we perform unit testing of the different modules individually and also do the integration testing once all the modules are completed. At the end we perform the performance testing to take a note on their desired output and other quality parameters.

4 0
3 years ago
Other questions:
  • When an IPv6 device with no pre-configured IPv6 address powers up, it can calculate a global 128-bit IPv6 address for itself usi
    12·1 answer
  • Why is it difficult to enforce laws against intellectual theft?
    10·1 answer
  • WILL GIVE  BRAINLIEST!! WILL REPORT TOO....
    13·1 answer
  • 2a
    8·1 answer
  • Write methods to do the following: a. Display three full lines of asterisks on the screen. b. Accept as an argument your name, a
    5·1 answer
  • is either the number of bits used to indicate the color of a single pixel, or the number of bits used for each color component o
    7·1 answer
  • The idea of supply and demand is based on the development of
    10·2 answers
  • What is that tool that makes liquid metal? Ik I might sound dumb but I'm rlly curious
    13·1 answer
  • To calculate subtotal for a table, the first step is to use the ____ button on the table tools design tab.
    15·1 answer
  • Complete each of the following sentences by
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!