Using 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

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter12: Adding Functionality To Your Classes
Section12.2: Providing Class Conversion Capabilities
Problem 6E
icon
Related questions
Question

Using 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.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 5 images

Blurred answer
Knowledge Booster
ADT and Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning