Question: Task1 A menu can easily be created using a simple do-while loop which prints options and waits for the user's input. Design a function which
Task1
A menu can easily be created using a simple do-while loop which prints options and waits for the user's input. Design a function which prints the menu and waits for user input.
Task2
Design a class for a delivery truck, DeliveryTruck. Start with a single data member of type string which will hold the advertising on the side of the truck. Your first menu option will display a default object of type DeliveryTruck.
Task3
We want the delivery truck to hold a bunch of packages. Add a data member, thePackages, to your class that will represent these packages by containing their weights (int/double?) in an array (max 50 elements, or dynamic, you choose). Your first menu option will now display a default object of type DeliveryTruck including both data members.
Task4
Let the truck owner change the advertising on his truck. Your second menu option should allow the user to input the advertising for the truck (a string; possibly multiple words) and will display the new result.
Task5
There is a packing list stored in a data file on your system. It consists of real numbers representing the weights of packages, each on a separate line. Add a member function to your class that will take the filename as a parameter and read these values into thePackages. Add a menu option to test this feature.
Task6
Add a data member to your class for the weight of your vehicle. Add a menu option to display the weight of your cargo, and the total weight of your loaded truck.
Task7
Modify your code so that each package has an ID number (integer). Now the package files will contain not only a weight but also an ID. The ID will be in the first column, the weight will be in the second and the columns will be separated by a whitespace.
Task8
Let the user determine if his/her package is on your truck (search by the ID number).
Task9
Our delivery company owns many trucks, so each truck should have a TruckID which is a unique number. Modify the DeliveryTruck class to have a TruckID which MUST be set when the truck is constructed. Provide an accessor function to get this truckID.
Task 10
Since our company owns many trucks, we'd like to be able to store all of those trucks in a class called DeliveryCompany. Design a class called DeliveryCompany which stores a vector of DeliveryTruck objects.
Task 11
Design a function in the DeliveryCompany class which will take an array (or vector) of delivery truck numbers and read their package files. Package files are store on the system with the number of the truck in the form of "truck112.txt".
Task 12
Add a menu option for the user to enter the truck numbers of all trucks (end with a negative number) which will create the company.
Task 13
Add the necessary menu option and class functions which will allow the user to search the entire company for their package ID number.... Congratulations, you're now the USPS.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
