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
UkoKoshka [18]
3 years ago
9

Prompt the user for an automobile service. Each service type is composed of two strings. Output the user's input. (1 pt) Ex: Ent

er desired auto service: Oil change You entered: Oil change (2) Output the price of the requested service. (4 pts) Ex: Enter desired auto service: Oil change You entered: Oil change Cost of oil change: $35 The program should support the following services: Oil change -- $35 Tire rotation -- $19 Car wash -- $7 If the user enters a service that is not listed above, then output the following error message: Error: Requested service is not recognized
Computers and Technology
1 answer:
Svet_ta [14]3 years ago
8 0

Answer:

Required code is given below.

Best Regards,

Please ask if any queries.

Explanation:

#include <stdio.h>

#include <string.h>

int main(void)

{

  char input[100];

  printf("Enter desired auto service:\n");

  scanf ("%[^\n]%*c", input);

  printf("You entered: %s\n",input);

  if(strcmp(input,"Oil change") == 0){

     printf("Cost of oil change: $35\n");

  }

  else if(strcmp(input,"Tire rotation") == 0){

     printf("Cost of tire rotation: $19\n");

  }

  else if(strcmp(input,"Car wash") == 0){

     printf("Cost of car wash: $7\n");

  }

  else{

      printf("Error: Requested service is not recognized\n");

  }

   

  return 0;

}

You might be interested in
What is wrong with the formula below?<br><br> SUM(A1:A5)/SUM(B1:B5)
Vlad [161]

Answer:

You forgot the "=" sign.

Explanation:

formulas in excel start with an "="

=SUM(A1:A5)/SUM(B1:B5)

4 0
4 years ago
100 POINTS!!!!!!!
bogdanovich [222]

A)

<u>~</u><u>Intellectual property needs to be protected because it usually has</u><u> </u><u>psychological</u><u> </u><u>value.</u>

Hope this helped you- have a good day bro cya)

4 0
3 years ago
Read 2 more answers
Write a program to help a travelling sales person keep up with their daily mileage driven for business. In your main method, the
Lelu [443]

Answer:

The programming language is not stated;

<em>The program written in C++ is as follows (See Explanation Section for detailed explanation);</em>

#include<iostream>

using namespace std;

int main()

{

 int numdays;

 cout<<"Number of days of mileage: ";

 cin>>numdays;

 int miles[numdays];

for(int i=0;i<numdays;i++)

{

 cout<<"Miles traveled on day "<<i+1<<": ";

 cin>>miles[i];

}

 int total = 0;

 for(int i=0;i<numdays;i++)

{

 total+=miles[i];

}

cout<<"Total mileage traveled: "<<total;

 return 0;

}

Explanation:

This line declares the number of days of mileage

 int numdays;

This line prompts user for days of mileage

 cout<<"Number of days of mileage: ";

This line accepts input from the traveler for days of mileage

 cin>>numdays;

This line creates an array

 int miles[numdays];

The italicized is an iteration that collects the user input for each day

<em> for(int i=0;i<numdays;i++)</em>

<em> {</em>

<em>  cout<<"Miles traveled on day "<<i+1<<": ";</em>

<em>  cin>>miles[i];</em>

<em> }</em>

This line initializes variable to 0

 int total = 0;

The italicized is an iteration that adds up the mileage traveled by the traveler each day  

<em>  for(int i=0;i<numdays;i++)</em>

<em> {</em>

<em>  total+=miles[i];</em>

<em> }</em>

This line prints the total miles traveled

cout<<"Total mileage traveled: "<<total;

5 0
4 years ago
To output age for the user which of the following you need to use?
koban [17]

Answer:

D

Explanation:

A is declaring a variable

B is getting input from the user and storing it in variable age

C is outputting the word "age" to the screen

D is outputting the word "age" to the screen and then outputting the value of the age variable immediately after which is correct.

6 0
3 years ago
Divide Rs60 in the ratio 1:4​
DanielleElmas [232]

Answer on the attachment

3 0
3 years ago
Other questions:
  • "​the three legs of a project triangle are _____, scope, and time."
    8·1 answer
  • What type of stud is placed below a windowsill to support its weight
    12·1 answer
  • You are asked to write an app to keep track of a relatively small music library. The app should load song information from a dat
    14·1 answer
  • The domain in an email message tells you what?
    11·1 answer
  • Which layer concerns the gateway to the network?
    10·1 answer
  • Do most good businesses have to deal with conflict
    7·1 answer
  • The labels on the tab buttons on the Driver tab of the Windows Device are Driver Details, Update Driver, Roll Back Driver, Unins
    12·1 answer
  • HELP WILL GIVE BRAINLIEST
    5·1 answer
  • (e) Give the output of the following:
    15·2 answers
  • Type of file containing instructions that tell your computer how to perform ___
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!