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 array index can be any nonnegative integer less than the array size.
suter [353]
I think the answer is true
7 0
3 years ago
Calls to the tostring( ) method emphasize the use of ____.
DaniilM [7]
<span>Polymorphic message
   
Methods in different classes with a similar function are given the same name. - Makes classes easier to use because programmers need to remember fewer method names. - Employed as much as possible. - Polymorphic message ex. is the toString method.</span>
5 0
3 years ago
Maxwell says three things Level Two Leaders do well are:
IRINA_888 [86]

Answer:

true

Explanation:

3 0
3 years ago
1. What is the difference between background sound and nat sound
OleMash [197]

Answer:

Well the background sound is the sound of course in the background and the nat sound is the curremt sound

Explanation:

6 0
2 years ago
help:(What are the uses of various lights? How are they all different? How do you decide on their usage? How can you use natural
Monica [59]

Answer:

This is one of the most common types of lighting. Ambient light is a soft glow that blankets your space just enough for you to function without causing a harsh glare. In photography and cinematography, ambient light is considered the "natural light" within a room. In décor, ambient light is very similar, except you create the ambient light by making the room's lighting as natural and flat as possible. While ambient light is meant to get you safely from point A-to-B, it is not ideal for working closely with things or to highlight things around your space. When used correctly, ambient light creates a fantastic environment to relax from an overly stressful day or to have a warm conversation with an old friend. Ambient lighting is often referred to as mood lighting, because this light captures the soft curves of your face and allows your pupils to dilate slightly (a physical sign of affection). Some yoga studios have even begun using the softer ambient lighting in their classes to help draw stress from the body. This is a smaller more concentrated light. You want task lighting around when you’re working. In fact, some people call it office lighting. Task lighting is meant to help you see when you’re doing projects in which you need a finer light, such as, reading, cooking, writing, sewing and many other things. Task lighting only works well when it is used as a contrasting light. For example, if you have a low lit room with a swing arm lamp turned on over your desk, the light over the desk surface will be more effective with less glare or shadow-effect than if the entire room was lit with a brighter light. Task lighting helps naturally stimulate your brain. The contrasting light allows you to be more alert and concentrated. This will help you see more details as you work, creating higher quality results. This is why many businesses choose to use task lighting in their offices.

Explanation:

5 0
3 years ago
Other questions:
  • This program has some errors in it that are needed to be checked import java.io.*;
    13·1 answer
  • What is this line of code doing? scanf("%f", &amp;height);
    6·1 answer
  • Imagine that the following two lines of code are placed inside a
    11·1 answer
  • If you want to present slides to fellow students or coworkers which productivity software should you use to create them A. Word
    14·2 answers
  • To access your gradebook you click on the __________.
    6·2 answers
  • An aerophone is an instrument that causes ________ to vibrate, thus creating sound waves.
    11·2 answers
  • Truth or dare????????????
    5·1 answer
  • You are setting up a small network. The customer has decided to change his internet service provider (ISP) to EtherSpeed. The IS
    9·1 answer
  • marianne needs to create a version of her slide presentation that does not include all the slides and will be used for a particu
    9·1 answer
  • Think of some local businesses that have websites. Look online and identify two different websites for businesses or services in
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!