subject

Driving cost - functions Write a function DrivingCost() with input parameters drivenMiles, milesPerGallon, and dollarsPerGallon, that returns the dollar cost to drive those miles. All items are of type double. If the function is called with 50 20.0 3.1599, the function returns 7.89975.
Define that function in a program whose inputs are the car's miles/gallon and the gas dollars/gallon (both doubles). Output the gas cost for 10 miles, 50 miles, and 400 miles, by calling your DrivingCost function three times.
Output each floating-point value with two digits after the decimal point, which can be achieved by executing
cout << fixed << setprecision(2); once before all other cout statements.
Ex: If the input is:
20.0 3.1599
the output is:
1.58 7.90 63.20
Your program must define and call a function:
double DrivingCost(double drivenMiles, double milesPerGallon, double dollarsPerGallon)
Note: This is a lab from a previous chapter that now requires the use of a function.
#include
#include // For setprecision
using namespace std;
/* Define your function here */
int main() {
/* Type your code here */
return 0;
}

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 17:00
Acase study allows a more detailed look at the life of a single subject than any other study.
Answers: 3
question
Computers and Technology, 23.06.2019 03:10
Acomputer has a two-level cache. suppose that 60% of the memory references hit on the first level cache, 35% hit on the second level, and 5% miss. the access times are 5 nsec, 15 nsec, and 60 nsec, respectively, where the times for the level 2 cache and memory start counting at the moment it is known that they are needed (e.g., a level 2 cache access does not even start until the level 1 cache miss occurs). what is the average access time?
Answers: 1
question
Computers and Technology, 23.06.2019 03:30
Hashtags serve to identify the topic of a given tweet true false
Answers: 2
question
Computers and Technology, 23.06.2019 15:00
Based on the current economic situation do you expect the employment demand for graduating engineers to increase or decrease? explain the basis for your answer. with a significant economic recovery, what do you think will happen to future enrollments in graduating engineering programs?
Answers: 1
You know the right answer?
Driving cost - functions Write a function DrivingCost() with input parameters drivenMiles, milesP...
Questions
question
Arts, 05.05.2021 19:50
question
Mathematics, 05.05.2021 19:50
question
Mathematics, 05.05.2021 19:50
question
Mathematics, 05.05.2021 19:50
question
Mathematics, 05.05.2021 19:50
question
Mathematics, 05.05.2021 19:50
Questions on the website: 13722361