C Programming Lanuage (C++): Write a program for Cody’s Car Care Shop that shows
ID: 3797854 • Letter: C
Question
C Programming Lanuage (C++):
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.
#include <stdio.h> -PLEASE
Explanation / Answer
Code in c
#include <stdio.h>
int main(){
// code is here
double tamnt=0;
int amnt=0,ch;
char exitoption;
printf("Welcome to Cody’s Car Care Shop ");
printf(" Select below menu services option: ");
printf(" 1. oil change ($25.00)");
printf(" 2. tire rotation ($22.00)");
printf(" 3. battery check ($15.00)");
printf(" 4. brake inspection ($ 5.00)");
printf(" 5. Final total Payment (plus 6%% tax).");
while(1){
printf(" Enter your choice : ");
scanf("%d",&ch);
switch(ch){
case 1: amnt += 25;break;
case 2: amnt += 22;break;
case 3: amnt += 15;break;
case 4: amnt += 5;break;
case 5: tamnt = (106*amnt/100.0);
printf("Net Total=$%d Tax = $%lf Grand Total = $%lf ",amnt, (6*amnt/100.0),tamnt);
break;
default: printf("Invalid you have enter. Plz the options and try again.");break;
}
printf(" Do you want to stop(Y/N)");
scanf("%c",&exitoption);
if(exitoption=='Y'||exitoption=='y'){
break;
}
}
printf(" Successfully done shopping..!! ");
return 0;
}
Input values at runtime:
1
N
4
N
6
N
5
Y
Ouput :
Welcome to Cody’s Car Care Shop
Hope this helps you..!!
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.