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
MatroZZZ [7]
3 years ago
12

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.
Computers and Technology
1 answer:
posledela3 years ago
4 0

Answer:

#include <iostream>

using namespace std;

double DrivingCost(int drivenMiles,double milesPerGallon,double dollarsPerGallon)

{

   double dollarsperMile=dollarsPerGallon/milesPerGallon;//calculating dollarsperMile.

   return dollarsperMile*drivenMiles;//returning thr driving cost..

}

int main() {

double ans;

int miles;

cout<<"Enter miles"<<endl;

cin>>miles;

ans=DrivingCost(miles,20.0,3.1599);

cout<<ans<<endl;

return 0;

}

Output:-

Enter miles

10

1.57995

Enter miles

50

7.89975

Enter miles

100

15.7995

Explanation:

In the function first I have calculated the dollars per mile and after that I have returned the product of dollarspermile and driven miles.This will give the cost of the Driving.

You might be interested in
Plz can someone tell me the answers ?
Ganezh [65]

Answer:

you can

Explanation:

you can

5 0
3 years ago
Read 2 more answers
Q1. Information systems that monitor the elementary activities and transactions of the organizations are: I a. Management-level
VashaNatasha [74]

Answer:

B. Operational-level systems monitor the elementary activities and transactions of the organization.

6 0
2 years ago
How do I give Brainliest?? I'll give brainliest...
Elodia [21]
Can i have it don’t think i ever got one
8 0
2 years ago
Read 2 more answers
Fill in the blank: With ticket ________, you are able to edit ticket properties according to which team owns the ticket.
velikii [3]

Answer: records customization

Explanation:

7 0
2 years ago
Which focal length and aperture combination is most likely to give you a deep depth of field?
frutty [35]

Answer:

f/11 is the answer I think

3 0
2 years ago
Other questions:
  • the task is to ask the user for three numbers and find the average which pseudocode gives you the comment outline for task​
    10·1 answer
  • Pix blocks półfinały skilled
    7·1 answer
  • Advancements in technology that might be helpful for individuals who need accommodations to perform computer tasks include _____
    15·2 answers
  • Throughout the course we have covered a lot of topics in relation to information systems. Select one or two of the major topics
    14·1 answer
  • Technician A says that high pressure in recycled refrigerant is only caused by air contamination. Technician B says that recycle
    15·1 answer
  • JAVA Question!
    13·1 answer
  • Which of the following is an online library?
    8·2 answers
  • Specific keys that each finger is responsible for typing is called A. ergonomics B. Touch typing C. Key reaches D. Posture
    8·1 answer
  • Alexis received paychecks from both her jobs and she would like to deposit them. One check is for $62.88 and the other is $523.2
    9·1 answer
  • How to print<br> 1<br> 321<br> 54321<br> 7654321<br> triangle pattern in python
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!