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
The purchase and subsequent sale of a securities position in a customer account solely to generate commissions is____________.
Citrus2011 [14]

Answer:

Churning

Explanation:

Churning is termed as an act of a broker conducting immoderate trading in the account of client solely to generate commissions. It is an illegal and deceptive practice. It violates security laws. The purchase and subsequent sale of a securities that are little or insignificant to meet the investment goals of client can be the evidence of churning. Consequently it causes considerable losses in client's account or can produce a tax liability.

Churning occurs due to over trading by a broker to generate commissions by buying and selling stocks excessively on the behalf of investor. This often happens when broker has permissive authority over client's account.

5 0
3 years ago
A storyboard is an example of an implementation tool.
alexdok [17]

Answer:

That's not true. A storyboard is an organizer to plan out certain things and to know how something should look before doing the finished product.

Explanation:

7 0
3 years ago
Proszę daje wszystko potrzebuje tego
Stolb23 [73]
I’m sorry I do not speak that
5 0
3 years ago
Read 2 more answers
HOW IS THE AUTOFILL FEATURE HELPFUL? A.IT CREATE A NEW FORMULA FOR EVERY CELL IN THE DOCUMENT B.IT CAN SAVE TIME BY ALLOWING YOU
bulgar [2K]
B. it can save time by allowing you to quickly fill cells
4 0
3 years ago
Gwen's company is planning to accept credit cards over the Internet. Which one of the following governs this type of activity an
podryga [215]

Answer:

Payment Card Industry Data Standard(PCI DSS).

Explanation:

The online payment acceptance through credit cards is governed by the Payment Card Industry Data Standard (PCI DSS) and it also includes the provisions that shoulde be implemented by gwen's company before accepting any transaction through credit cards.

8 0
3 years ago
Other questions:
  • 1. Which of the following are considered CAD powerhouses?
    6·1 answer
  • What feature of a word processing program helps you to easily check and correct spelling mistakes?
    9·1 answer
  • An aircraft departs an airport in the mountain standard time zone at 1615 MST for a 2-hour 15-minute flight to an airport locate
    14·1 answer
  • Should the federal government have bug bounty programs? Why or why not?
    9·2 answers
  • What is sum after the following loop terminates? int sum = 0; int item = 0; do { item ; sum = item; if (sum &gt; 4) break; } whi
    8·2 answers
  • The company generates a lot of revenue and is rapidly growing. They're expecting to hire hundreds of new employees in the next y
    6·1 answer
  • Excerpt from "How Prepared Are Students for College Level Reading? Applying a Lexile-Based Approach."
    6·1 answer
  • 5. The command to add new layout to the slide is present in<br>tab.​
    15·1 answer
  • What is the<br>Way to<br>keep the tool<br>Screw​
    6·1 answer
  • Clara works behind a computer all day. She gets a lot of headaches, and her eyes have been hurting her lately. Her doctor diagno
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!