Question: Objective: The main objective of this assignment is checking the students ability to work with ADTs. In this week's assignment, you will be writing the
Objective: The main objective of this assignment is checking the students ability to work with ADTs. In this week's assignment, you will be writing the interface of an ADT in order to conform to the requirements of a larger application.
Description: You have joined a team working on a traffic simulation framework. The framework implementation and base algorithms that are expected to populate it, will require functionality associated with number of vehicle entities and their attributes.
You must create 2 ADTs: Vehicle and Manager.
Vehicle has the following attributes: o Type o Age o Length o Width o Maximum Speed
The type attribute must accept only two values: car, and truck. The age must be in the range of 1 and 20. Length must be in the range from 3 to 5 for cars, and 6 to 8 for trucks. Width must be in the range from 1 to 2 for cars, and 2 to 3 for trucks. Maximum speed must be in the range from 140 to 200 for cars, and 120 to 140 for trucks.
Manager has the following attributes:
o int n_vehicles: representing the total number of vehicles in the simulation. The value must be set to 200 o int n_trucks: representing the number of trucks in the pool of 200 vehicles. o Vehicle array[200]: representing the structure that will hold the vehicles o bool generated: specifying whether the vehicle list has been created or not
The role of this ADT is to provide functionality to the manager, towards generating the vehicle list, printing the list, and editing any vehicles attributes after their generation.
The attributes are all private to ensure that they wont be changed by mistakes or nave implementation. You must use get and set functions to manipulate and access them.
Task 1: Populate Vehicle List The manager must be prompted to enter the number of trucks. Then all the attributes for all vehicles must be randomly generated, according to the restrictions listed in the Description section.
Task 2: Print Vehicle List Print each vehicle on the screen, listing each attribute.
Task 3: Edit List Prompt the manager to select an index, representing the vehicle that is to be edited. Then prompt for the attribute that is to be edited: type, age, length, width, max speed, or to exit the editing process. The manager must be able to edit more than one attribute as well as to choose to exit the editing menu. Furthermore, the type-related restrictions of a vehicles attributes do not apply in the edit mode; the manager should be able to assign width, length, and max speed of type car, to a truck, and vice versa.
Task 4: Main Menu The manager must have access to a menu, allowing the execution of the above tasks as well as having the option to exit. Given that list manipulation and printing are not possible when the list has not been generated, the possible actions should be filtered accordingly, not allowing the manager to print or edit. Similarly, once the list has been generated, the manager should not have the option to re-generate it
If illegal values are inserted by the manager, both in the main menu and edit mode, the program should continue prompting for valid input until one is given.
Zip the entire Code::Blocks project containing all the .cpp, .h, .cbp files name the zipped file Assg7_cslogin.zip, where the cslogin is your login ID for the computers at the Department of Computer Science at ODU. Submit the zipped file using the appropriate Blackboard link.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
