Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Design a program for a trucking company that has seven trucks in its fleet. Each

ID: 3758789 • Letter: D

Question

Design a program for a trucking company that has seven trucks in its fleet. Each truck is identified by a number from one to seven and has a maximum weight allowance, which has already been determined. assign the maximum weight limit to each truck at initialization. Before a truck can begin its route, it must be weighted to see if it falls within its weight allowance. ask the user for the truck number and the loaded weight. Display a message indicating whether the truck falls in the allowable weight limit. Use the following values as maximum weight limits, and enter the weight-in values for each truck. trucknum1 max weight allowance=50000lb and its weight =45000lb

Trucknum2 max weight allowance 25000lb and its weight =30000lb

Trucknum3 max weight allowance=20000lb and its weight=20000lb , trucknum4 max weight allowance=35000lb and its weight =30000lb, trucknum5 max weight allowance=40000lb and its weight=35000lb, trucknum6 max weight allowance=25000lb and its weight=27000lb, trucknum7 max weight allowance=30000lb and its weight=20000lb. Using array please thank you

Explanation / Answer

Here is the C++ code for you. If you have any further queries, just get back to me.

#include <iostream>
using namespace std;
int main()
{
unsigned int truckNumber, loadedWeight, anotherTruck;
unsigned int maxWeights[] = {50000, 25000, 20000, 35000, 40000, 25000, 30000};
while(1)
{
cout<<"Enter the truck number: ";
cin>>truckNumber;
cout<<"Enter the loaded weight: ";
cin>>loadedWeight;
if(loadedWeight > maxWeights[truckNumber-1])
cout<<"The truck is OVERLOADED. It can't enroute further."<<endl;
else if(loadedWeight == maxWeights[truckNumber-1])
cout<<"The truck is filled to its capacity. Travel with care."<<endl;
else
cout<<"The truck is sufficiently loaded. Have a safe trip."<<endl;
cout<<"Do you want to check another truck. Press 1 for YES: ";
cin>>anotherTruck;
if(anotherTruck != 1)
break;
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote