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
I have a question about a hotel tv:
UNO [17]

1 Open the back cover of the Nintendo Switch Dock.

2 Connect the USB plug from the Nintendo Switch AC adapter (model No. ...

3 Connect one end of the HDMI cable into the bottom terminal of the dock labeled "HDMI OUT," then connect the other end into an HDMI port on your television or monitor.

                                                                                                   your welcome

3 0
3 years ago
What is one problem you should keep in mind when researching information on the Internet?
shepuryov [24]
The answer is A due to the internet being a plethora of information being accessed by anyone and everyone with internet access. Any person of no background to certain information could claim mastery to the field and sway his/her audience to ways possible. Ensuring that the source of the information being read is from credible and reputable companies. You can do this by ensuring the information is from newspapers with names known all over the world or there are also sourced footnotes from the author where they could have cited some information from other articles. 
5 0
3 years ago
Read 2 more answers
What skill would be easiest to learn from a simulation video game?
garik1379 [7]

Answer:

D

Explanation:

the first three you would need hands-on practice to learn.

5 0
3 years ago
Read 2 more answers
How many country on earth​
Reika [66]

Answer:

195 countries

I think Soo

8 0
3 years ago
Read 2 more answers
What is an optical drive used for?​
solong [7]

Optical Disc Drive (ODD) An optical disc drive (ODD)

for using CDs, DVDs, and Blu-ray discs to listen to music or watch a movie.

Most drives also allow you to write data to a disc, so you can create your own music CDs, video DVDs or even create of back-up copy of your important data files.

dell.com

4 0
2 years ago
Read 2 more answers
Other questions:
  • Alice has to move around a lot to fetch objects at her workstation. Which ergonomic principle should Alice follow to prevent str
    8·2 answers
  • Are sql injections legal?
    15·1 answer
  • The following function open_file() opens a file called 'example.txt' and returns the file pointer. This function is called withi
    12·1 answer
  • .All of the following are true with the respect to implicitinvocation except:
    8·1 answer
  • After reading the article, "The Impact of Technology", answer the following question.
    14·1 answer
  • What hernia repair codes can be reported with add-on code 49568?
    6·1 answer
  • In order to plan George’s birthday, his father gave him a list of people who attended his birthday for the last five years. What
    8·1 answer
  • What is the most likely reason that a digital artist would use a program such as Autodesk Maya or Max to create 3-D images for a
    12·1 answer
  • AYYOOOO CAN YOU HELP A GIRL OUUTT???
    11·1 answer
  • A router periodically goes offline. Once it goes offline, you find that a simple reboot puts the router back online. After doing
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!