Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ Write a program that creates a Bus class that includes a bus ID number, number of seats, driver name, and current speed. Create

In C++

Write a program that creates a Bus class that includes a bus ID number, number of seats, driver name, and current speed. Create a default constructor without any parameters that initializes the value of ID number, number of seats, and driver name. Create another constructor with three parameters of bus id number, number of seats, and driver name. Car speed should always be initialized as 0.

The program will also include the member functions to perform the various operations: modify, set, and display bus information (Bus id, number of seats, driver name, and current speed).

For example:

- Set the bus id number

- Set the number of seats

- Set of driver number

----------------------------------------------------

- Return the bus id number by using get method

- Return the number of seats

- Return of driver number

- Return the current speed

-----------------------

Member function to display the bus information

- busInformation()

Also write two member functions, Accelerate() and Brake(). Whenever Accelerate() is called, increase the speed by 5 (cannot exceed 50), and whenever Brake() is called, decrease the speed by 5 (cannot be negative). Write a program that declares several Bus objects and demonstrates that all the functions work correctly.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems A Practical Approach To Design Implementation And Management

Authors: THOMAS CONNOLLY

6th Edition

9353438918, 978-9353438913

More Books

Students also viewed these Databases questions

Question

What type of advice and counsel do SCORE volunteers provide?

Answered: 1 week ago

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago