Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objective: user-defined functions. Void functions, and functions with input/output parameters. Instructions: Every problem should be written as a void function(void 01 (void)) that is called

image text in transcribed
Objective: user-defined functions. Void functions, and functions with input/output parameters. Instructions: Every problem should be written as a void function(void 01 (void)) that is called in the main function (01(). Submit the source code through Canvas. yourname Lab3.c is the file name. Use proper commenting at the beginning of your code with your name, lab number and date. (10 points deduction for not following any of the given formats) 1. Write a program that produces the following output: For that's a beautiful car! For that's a beautiful car! For that's a beautiful car! Which nobody can deny. Have the program use two user-defined functions; one that prints the "beautiful car" message once, and one that prints the final line once. (6 points) 2- Write a program that determines the gas mileage of a car based on the miles travelled and gallons of gas consumed. (9 points) a. First ask the user to enter the number of miles traveled and the number of gallons of gasoline consumed. b. Then calculate and display the miles-per-gallon value (MPG), showing one place to the right of the decimal. c. Next, using the fact that one gallon is about 3.785 liters and one mile is about 1.609 kilometers, convert the mile-per-gallon value to a liters-per-100-km value (L/100km), and display the result, showing two places to the right of the decimal. Note: The U.S. scheme measures the amount of fuel per distance, whereas the European scheme measures the distance per amount of fuel. d. Use symbolic constants (using #define) for the two conversion factors. The US government website should help in determining the actual MPGs for cars on the market: https://www.fueleconomy.gov/feg/findacar.shtml

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learning PostgreSQL

Authors: Salahaldin Juba, Achim Vannahme, Andrey Volkov

1st Edition

178398919X, 9781783989195

More Books

Students also viewed these Databases questions

Question

1. Select the job or jobs to be analyzed.

Answered: 1 week ago