Design and implement an interactive program named trip.c that collects information about the user's car and...

50.1K

Verified Solution

Question

Electrical Engineering

Design and implement an interactive program named trip.c thatcollects information about the user's car and planned travel, andreports back useful information.

The dialog below shows exactly what data should be collected asinput and reported as output.

Some Hints to get started /* Not tested not complete code Justto get you started

*/ #include

/* FUNCTION PROTOTYPES */

void WelcomeMessage();

void AskUserForInput(); /* ask and check whether user wants tocontinue if wants to continue gather information and calculate theresults (optional create more functions) */

void PrintTripSummary(float fuel, float minCost, float maxCost,float travelMiles); /* could call this from AskUserForInput(); In aloop and feed it the user input */

/* MAIN */

int main() {

/* Call the functions */

return 0;

}

You do not need to verify user input data. Presume that the userenters reasonable/correct data.

Although you might want to test the results of entering\"interesting data\" such as alpha data instead of numeric.

Below is the program output. Black is used toillustrate the output, while regular text shows user Input.

Welcome to the Trip Planner!

So you are ready to take a trip? Let me help you planfor your fuel costs and required stops to fill up your tank.============================================================

Please provide answers to the prompts below and I willdisplay a summary for you when I have computed the results.============================================================

Please input your car's average miles per gallon (enter0 to quit) >> 16

Please tell me the range of fuel costs you expect to pay(per gallon).

The lowest per gallon cost of fuel is >>4.17

The highest per gallon cost of fuel is >>5.20

Please tell me how many miles you plan to travel>> 900

=============== Trip Summary==================

You will need to purchase approximately 56 gallons offuel.

The approximate cost of fuel for your trip is between$235 and $293

=============== End Trip Summary==================

Please input your car's average miles per gallon (enter0 to quit) >> 11

Please tell me the range of fuel costs you expect to pay(per gallon).

The lowest per gallon cost of fuel is >>4.17

The highest per gallon cost of fuel is >>5.20

Please tell me how many miles you plan to travel>> 1300

=============== Trip Summary==================

You will need to purchase approximately 118 gallons offuel.

The approximate cost of fuel for your trip is between$493 and $615

=============== End Trip Summary==================

Please input your car's average miles per gallon (enter0 to quit) >> 0

Thank you, please drive safely and have a nicetrip!

Answer & Explanation Solved by verified expert
4.3 Ratings (765 Votes)
include include include void welcomeMessage void AskUserForInput void printtripsumfloatfloatfloatfloat void welcomeMessage printfWelcome to the Trip PlannernSo you are ready to take a tripnLet me help your plan for your fuel costs and required stops to fill up    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students