Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A Moving to another question will save this response. Question 38 What is the ou

ID: 3578673 • Letter: A

Question

A Moving to another question will save this response. Question 38 What is the output of the following code snippet? class Car public: Car speed 03 Car (double s) speed s double get speed() const f return speed, private: double speed, class AeroCar public Car public: Aerocar height 03 Aerocar (double h, double s) Car(s 2) height hi void display data() const; private: double height; void AeroCar: display data() const cout "Speed: Car: get speed() Height height end int main AeroCar acar1(2000, 200); acar1 display data()s return 0, A. Speed: 0: Height: 0 B. Speed: 0. Height: 2000 C. Speed: 400: Height: 2000 D. Speed: 200: Height: 2000 A Moving to another question wll save this response.

Explanation / Answer

Answer:

38) D) Speed: 400; Height: 2000

class Car
{
public:
Car();
Car(double new_speed);
double get_speed() const;
private:
double speed;
};
Car::Car()
{
speed = 0;
}
Car::Car(double new_speed)
{
speed = new_speed;
}
double Car::get_speed() const
{
return speed;
}
class AeroCar : public Car
{
public:
AeroCar();
AeroCar(double new_height, double new_speed);
void display_data() const;
private:
double height;
};
AeroCar::AeroCar()
{
height = 0;
}
AeroCar::AeroCar(double new_height, double new_speed)
: Car(new_speed * 2)
{
height = new_height;
}
void AeroCar::display_data() const
{
cout << "Speed: " << Car::get_speed() << "; Height: " << height << endl;
}
int main()
{
AeroCar acar1(2000, 200);
acar1.display_data();
return 0;
}

Output: Speed: 400; Height: 2000

39) option C) 2

class CashRegister
{
public:
CashRegister();
CashRegister(int count);
void set_item_count(int count);
void view() const;

private:
int item_count;
};

CashRegister::CashRegister() { set_item_count(0); }
CashRegister::CashRegister(int count)
{
set_item_count(count);
}

Output: 2

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote