Asked by Marsha
a car rental company uses the following table to help compute rental fees . Chevrolet $50.00 , corvette 85.00 , Pontiac 53.00 , Buick 60.00 , Oldsmobile 60.00 , Cadillac 70.00 (Rate per Day) . Rate per Mile .27 , .45 , .32 , .32 , .35 , .40 . It have to be in a C++ language
Answers
Answered by
MathMate
Store three arrays:
String[] model={"Chevrolet",....};
double[] dailyRate={50,85,53,60,60,70};
double[] milageRate={0.27, 0.45,....0.40};
int nModel=0;
int milage=0;
double cost;
then present a menu for user to choose from, remembering that model[0]="Chevrlet" because C++ arrays are numbered starting from zero.
The model number should be stored in nModel.
Input milage and do calculation of cost using
cost=dailyRate[nModel]+milage*milageRate[nModel];
Output the calculated cost.
String[] model={"Chevrolet",....};
double[] dailyRate={50,85,53,60,60,70};
double[] milageRate={0.27, 0.45,....0.40};
int nModel=0;
int milage=0;
double cost;
then present a menu for user to choose from, remembering that model[0]="Chevrlet" because C++ arrays are numbered starting from zero.
The model number should be stored in nModel.
Input milage and do calculation of cost using
cost=dailyRate[nModel]+milage*milageRate[nModel];
Output the calculated cost.
There are no AI answers yet. The ability to request AI answers is coming soon!
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.