C++ Programming Lanuage: Write a program for Cody’s Car Care Shop that shows a u
ID: 3796799 • Letter: C
Question
C++ Programming Lanuage: Write a program for Cody’s Car Care Shop that shows a user a list of available services:
1. oil change $25.00
2. tire rotation $22.00
3. battery check $15.00
4. brake inspection $ 5.00
5. calculate total Allow the user to select several choices, and when they select 5, calculate the final total (plus 6% tax).
Create an array that holds the prices. As the user selects an option, display the option number and its price as $25, $22, $15, or $5, accordingly. Display an error message if the user enters an invalid item. When the user selects 5, display the net total, the amount of tax, and the grand total.
Explanation / Answer
#include <iostream>
using namespace std;
int main()
{
int r;
double sum=0;
while(true)
{
cout<<"The list of services:"<<endl;
cout<<"1. Oil change $25.00"<<endl;
cout<<"2. Tire rotation $22.00"<<endl;
cout<<"3. Battery check $15.00"<<endl;
cout<<"4. Brake inspection $5.00"<<endl;
cout<<"5. Calculate total"<<endl;
cout<<"Please select a service:";
cin>>r;
if(r==1)
{
sum = sum+25;
}
else if(r==2)
{
sum += 22;
}
else if(r==3)
{
sum += 15;
}
else if(r==4)
{
sum += 5;
}
else if(r==5)
{
cout<<"The total for all the services with 6% tax is "<<sum*1.06<<endl;
break;
}
}
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.