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]
2 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]2 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
Discuss the advantages of using analogue multi-tester or digital multi-tester over the other.​
QveST [7]

Answer:

Advantages of Digital Multimeters:

1)They are more accurate than analog multimeters.

2)They reduce reading and interpolation errors.

3)The 'auto-polarity' function can prevent problems from connecting the meter to a test circuit with the wrong polarity.

4)Parallax errors are eliminated.

I hope this helps.

8 0
2 years ago
The array mycats is an 8 element array of type kitty that has already been declared and initialized. write the expression(s) in
Basile [38]
Console.log(mycats[3])
5 0
3 years ago
Factoring of integers. Write a python program that asks the user for an integer and then prints out all its factors. For example
Oduvanchick [21]

num = int(input("Enter a number: "))

i = 2

while num > 1:

   if num % i == 0:

       num = num / i

       print(i, end=" ")

       i = 2

   i += 1

I hope this helps!

8 0
2 years ago
During which part of an examination are various body parts and organs touched and felt?
scoray [572]

The correct answer is B. Palpation

Explanation:

In a medical exam or similar, the palpation involves touching different parts of the body to feel the organs and structures in this. This process is essential in diagnosis because palpation can reveal inflammation, pain in certain areas, or abnormalities. Additionally, palpation requires a broad knowledge of anatomy that allows health professionals to understand the structures of the body when they touch these and how to determine abnormalities. Thus, the part of an examination in which body parts are touched and felt is palpation.

8 0
3 years ago
What is the quotient of 8.16 ÷ 100​
Natalka [10]

Answer:

0.0816

Explanation:

8.16 ÷ 100 = 0.0816 (Ans)

6 0
2 years ago
Other questions:
  • Marie uses a browser to visit a blog. What is the unique identifier of the blog? A. web page B. website C. web address D. email
    7·2 answers
  • In Word, tables can be styled much like text can.<br> True<br> False
    6·1 answer
  • Which of the following was one of the first internet search engines? A. archie B. google C. Yahoo D.ask
    7·1 answer
  • To create a formula in. . You would first click in one of the cells
    12·2 answers
  • How do governments correct for negative externalities?
    5·1 answer
  • ____ is the official web portal for the U.S. government, providing access to all official U.S. government services and informati
    12·1 answer
  • Please help if you answer correcly i will give you brainelst!!!!!!!!!!!!!!!!!!
    6·2 answers
  • Supplies/material used in iron​
    11·1 answer
  • Similarities between master file and reference file
    12·1 answer
  • Find out about the different technological solutions available for interconnecting LANs to from larger networks such as wide are
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!