Question: Program Requirements: Design a base class, Road, with the following members: Attributes for storing the road's name, number of lanes, and maximum speed limit .
Program Requirements:
Design a base class, Road, with the following members:
Attributes for storing the road's name, number of lanes, and maximum speed limit
A threeparameter constructor to initialize the three attributes.
Accessors and Mutators Gets and Sets for each attribute.
Input Validation: You should ensure that the number of lanes is always a value greater
than and that the maximum speed limit is a value between and This input
validation should apply to both the parameter constructor and the individual accessor
functions.
A display function that prints the road's information in a single line format see the Sample
Output for a formatting example
Design a derived class, TollRoad, which inherits from Road. It should have the following members:
An attribute for storing the toll for using the road.
A parameter constructor to initialize the three attributes of the base class, as well as
the toll.
Accessor and Mutator methods for the toll.
Input Validation: You should ensure that the toll is a value greater than This validation
should apply to both the parameter constructor as well as the individual accessor.
An overridden display function that displays the information of the TollRoad in a twoline
format, where the first line displays basic Road information, and a second line specifies
the current toll see Sample Output for a formatting example
In the main, you should demonstrate the capabilities of your classes by allowing the user to create
new roads or toll roads as well as display a list of all previously created roads and their
information via their display function
Your program should allow the user to add at least ten Roads andor TollRoads, which
should be represented in a single array. For an additional challenge, you may choose to
remove that limit and support any number of roads, but this is not a requirement of the exam.
The Sample Output provided below is an example of the intended functionality. Your output
does not need to be an exact match for the sample, but should fulfill all the same tasks.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
