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
Andrei [34K]
3 years ago
5

In this lab, you create a derived class from a base class, and then use the derived class in a C++ program. The program should c

reate two Motorcycle objects, and then set the Motorcycle’s speed, accelerate the Motorcycle object, and check its sidecar status.
Engineering
1 answer:
Mnenie [13.5K]3 years ago
7 0

Answer:

See explaination

Explanation:

Program source code below.

#include "Motorcycle.cpp"

#include <iostream>

using namespace std;

int main()

{

Motorcycle motorcycleOne,motorcycleTwo;

motorcycleOne.setSidecar(true);

motorcycleTwo.setSidecar(false);

motorcycleOne.setMaxSpeed(90);

motorcycleTwo.setMaxSpeed(85);

motorcycleOne.setSpeed(65);

motorcycleTwo.setSpeed(60);

motorcycleOne.accelerate(30);

motorcycleTwo.accelerate(20);

cout<<"MotorcycleOne speed:"<< motorcycleOne.getSpeed()<<endl;

cout<<"MotorcycleTwo speed:"<< motorcycleTwo.getSpeed()<<endl;

if(motorcycleOne.getSidecar())

cout<<"MotorcycleOne has a sidecar"<<endl;

else

cout<<"MotorcycleOne does not have a sidecar"<<endl;

if(motorcycleTwo.getSidecar())

cout<<"MotorcycleTwo has a sidecar"<<endl;

else

cout<<"MotorcycleTwo does not have a sidecar"<<endl;

// Create Motorcyle objects here

// Create a boolean variable for side car status

// Set side car status here

// Set maximum speed here

// Set current speed here

// Accelerate motorcyles here

// Display current speed here

// Determine side car status and display results.

return 0;

}

Motorcycle.cpp

#include "Vehicle.cpp"

#include <iostream>

using namespace std;

class Motorcycle:public Vehicle{

public:

void setSidecar(bool);

bool getSidecar();

void accelerate(double);

private:

bool sidecar;

};

void Motorcycle::setSidecar(bool s){

sidecar=s;

}

bool Motorcycle::getSidecar(){

return sidecar;

}

void Motorcycle::accelerate(double mph)

{

if(getSpeed() + mph < getMaxSpeed())

setSpeed(getSpeed() + mph);

else

cout << "This motorcycle cannot go that fast." << endl;

}

You might be interested in
Horizontal wind turbines have same design for offshore and on shore wind farms. a)-True b)- False
Zigmanuir [339]

Answer: False

Explanation: Horizontal axis wind turbines are usually used for generation of the electric power on the off-shore. The generation of horizontal-axis wind turbine works well when it is installed away from the shore because it supports large sized wind turbines so that they can generate high amount of electricity.They are usually not preferred for the on-shore wind farms because they can have small sized wind turbines only.Therefore the statement given is false.

8 0
3 years ago
If the Zener diode is connected<br>wrong polarity the voltage<br>across the load is?​
o-na [289]

Answer:

i think so

Explanation:

6 0
3 years ago
Why does the the diffusion capacitance fall off at high frequencies?
Vitek1552 [10]

Answer:

The answer 1 is correct.

Explanation:

When a junction called the p-n is forward biased, the capacitance of diffusion will form or structured across depletion layers.

When at a higher frequency or frequencies, the dopants, are vibrated across the metallurgical junction and the doping profiles smooths out.

4 0
4 years ago
Problem a) – c): Use the method of joints, the method of sections, or both to solve the following trusses. Draw F.B.Ds for all y
Ghella [55]

Answer:

This is confusing sorry

Explanation:

7 0
3 years ago
Given x = 67 and y = 18, use two's complement to calculate:(1)x+y (2) x-y (3)-x+y (4)-x-y. Do the calculation, show the results
joja [24]

Answer:

See attachment

Explanation:

8 0
3 years ago
Other questions:
  • Work-producing devices that operate on reversible processes deliver the most work, and work-consuming devices that operate on re
    6·1 answer
  • Technician A says diesel engines are also called compression ignition engines. Technician B says diesel engines have much higher
    9·1 answer
  • Which of the following best describes solids, liquids, and gases? the speed at which fluids flow the measurement of elasticity i
    12·2 answers
  • Sketch T-s and p-v diagrams for the Diesel cycle.
    8·1 answer
  • Consider a large plane wall of thickness L = 0.3 m, thermal conductivity k = 2.5 W/m · °C, and surface area A =12 m2. The left s
    6·1 answer
  • The Torricelli's theorem states that the (velocity—pressure-density) of liquid flowing out of an orifice is proportional to the
    5·1 answer
  • Under maximum power transfer conditions, the operating efficiency of a system is 100%. (a) True (b) False
    6·1 answer
  • Nick Bolger kept $1,200 on deposit for six months in a three-month money market account that pays simple interest. For the first
    11·1 answer
  • 1. Which of these materials is the strongest?
    12·1 answer
  • What is engineering?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!