1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
AlexFokin [52]
3 years ago
9

(1) Output a menu of automotive services and the corresponding cost of each service. (2 pts)Ex:Davy's auto shop servicesOil chan

ge -- $35Tire rotation -- $19Car wash -- $7Car wax -- $12(2) Prompt the user for two services. Each service type is composed of two strings. (2 pts)Ex:Select first service: Oil changeSelect second service: Car wax(3) Output an invoice for the services selected. Output the cost for each service and the total cost. (3 pts)Davy's auto shop invoiceService 1: Oil change, $35Service 2: Car wax, $12Total: $47(4) Extend the program to allow the user to enter a dash (-), which indicates no service. (3 pts)Ex:Select first service: Tire rotationSelect second service: -Davy's auto shop invoiceService 1: Tire rotation, $19Service 2: No serviceTotal: $19**THIS MUST BE IN THE C LANGUAGE**

Computers and Technology
1 answer:
Helen [10]3 years ago
6 0

Answer:

Follows are the code to this question:

#include <stdio.h>//header file

#include <string.h>//header file

int main()//main method

{

char f_service[100], s_service[100];//defining character array

int total;//defining integer variable

do

{

   total = 0;//assign value in total variable

   printf("Davy's auto shop services\n");//print message

   printf("Oil change -------- $35\n");//print message

   printf("Tire rotation ------ $19\n");//print message

   printf("Car wash ---------- $7\n");//print message

   printf("Car wax ----------- $12\n");//print message

   printf("Enter first service: \n");//print message

   fgets(f_service, 100, stdin);//use get function for input value

   f_service[strlen(f_service) - 1] = '\0';//use length function for calculate total length

   printf("Enter second service: \n");//print message

   fgets(s_service, 100, stdin);//use get function for input value

   s_service[strlen(s_service) - 1] = '\0';//use length function for calculate total length

   printf("\nDavy's auto shop invoice\n\n");//print message

   if(strcmp(f_service, "Oil change") == 0)//defining if block that check first input Service

   {

     printf("Service 1: %s, $%d\n", f_service, 35);//print service name with rate

     total = total+ 35;//calcaulte value in total variable

   }

   else if(strcmp(f_service, "Tire rotation")== 0)

   {

     printf("Service 1: %s, $%d\n", f_service,19); //print service name with rate

     total = total + 19;//calcaulte value in total variable

   }

   else if(strcmp(f_service, "Car wash") == 0)

   {

     printf("Service 1: %s, $%d\n", f_service, 7);//print service name with rate

     total = total + 7;//calcaulte value in total variable

   }

   else if(strcmp(f_service, "Car wax") == 0)

   {

    printf("Service 1: %s, $%d\n", f_service, 12); //print service name with rate

     total = total + 12;//calcaulte value in total variable

   }

   else

   {

     printf("Service 1: Empty\n");//print message

   }

   if(strcmp(s_service, "Oil change") == 0)

   {

     printf("Service 2: %s, $%d\n", s_service, 35);//print service name with rate

     total= total+ 35;//calcaulte value in total variable

   }

   else if(strcmp(s_service, "Tire rotation")== 0)

   {

     printf("Service 2: %s, $%d\n", s_service, 19);//print service name with rate

     total = total + 19;//calcaulte value in total variable    

   }

   else if(strcmp(s_service, "Car wash") == 0)

   {

   printf("Service 2: %s, $%d\n", s_service, 7);//print service name with rate

   total = total + 7;//calcaulte value in total variable

   }

   else if(strcmp(s_service, "Car wax") == 0)

   {

   printf("Service 2: %s, $%d\n", s_service, 12);//print service name with rate

   total= total+ 12;//calcaulte value in total variable

   }

   else if(strcmp(s_service, " ") == 0)

   {

   printf("Service 2: No service\n");//print service name with rate

   }

   else

   {

   printf("Service 2:No service\n");//print message

   }

   printf("Total: $%d\n", total);//print total value

   }

   while(strcmp(s_service, "_"));//defining while that compare second service value

return 0;

}

Output:

Please find the attached file.

Explanation:

In the given C language code, the two-character array "f_service and s_service" and one integer variable "total" is declared, in which character array is used for user input, and the total is used for calculating value.

  • In the next step, the do-while loop is used, in which we used multiple conditional statements, that check "first and second" both array input value and add values into the total variable.
  • If the first array doesn't take any input value, it will print an "empty" message. Similarly, in the second array, if it can't take any value, it will print a message "No service", and for the exit from the program, we pass the "underscore (_)" symbol.  

You might be interested in
A(n) _______________ is a network organization that centralizes user accounts, passwords, and access to resources.
MakcuM [25]

Answer:

A router

Sentence:

A(n) <u>router</u> is a network organization that centralizes user accounts, passwords, and access to resources.

8 0
2 years ago
Which one of the following analog VOM ranges would be selected to measure a DC
tensa zangetsu [6.8K]
<span>100 mA of course. You cannot use 10 mA because it will be over the range and the higher ranges are not accurate at 90 mA</span>
7 0
3 years ago
Brock wants to use several images on his hiking blog. However, the images are making his pages load very slowly. Explain to Broc
attashe74 [19]
First brock has to make sure he has all the hiking gear, like a camel back, gloves, the right pair of shoes. and then if he wants to take pictures he should buy a go-pro so he doesn't really have to move will the go-pro will record or take pictures.
hope i helped 0-0 ;p
plz mark brainly
5 0
3 years ago
What is transmission control protocol?
xz_007 [3.2K]

Answer:

it is a connection-oriented communications protocol that facilitates the exchange of messages between computing devices in a network.

Explanation:

3 0
3 years ago
Like when writing a paragraph, the subject becomes the __________ of the photograph.
Natali5045456 [20]
It is A, the theme is the subject.
8 0
3 years ago
Other questions:
  • You are tasked with setting up an employee’s computer.Instead of a new computer,she will be using a computer with an older opera
    11·2 answers
  • What is a nonlinear presentation
    9·2 answers
  • When inside a closed work environment, its okay to openly talk with co-workers about PII
    6·1 answer
  • A ________ is hardware or software that acts as a filter to prevent unwanted packets from entering a network.
    9·2 answers
  • Suppose we are comparing the implementations of insertion sort and merge sort on the same machine(You don’t need to know the alg
    13·1 answer
  • What is the name given a technological program that typically copies itself and moves through a computer system in order to disr
    10·1 answer
  • ___________ is related to mass, but also includes the gravitational pull of the Earth.
    14·1 answer
  • Which expression is equivalent to 3x + 3x + 3x?<br><br> From Performance Matters
    11·2 answers
  • What is data analysing data and give three examples ?​
    9·1 answer
  • When you pass a double variable to a method, the method receives ______.a) a copy of the memory addressb) the reference of the v
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!