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
In which part of a browser will you type the url of a website
Stells [14]

You would type the URL of a website in the address bar, which is a white bar located on the top of your screen.

5 0
3 years ago
What is an administrator?
Drupady [299]
A person responsible for running a business, organization, etc.
3 0
3 years ago
If a class has member variables that are pointers, you must ensure that you implement ____.
DedPeter [7]

Answer:

objects

Explanation:

pointer are used for the objects

5 0
3 years ago
5 differences between a regular mouse and a gaming mouse​
alexdok [17]

Answer:

A gaming mouse has more buttons to keybind to while a regular mouse is simpler

Explanation:

6 0
2 years ago
Current versions of windows support file names up to ________ characters long
Verizon [17]
Newer, or current versions of Windows from XP to 10 use the NTFS file system. The file system supports up to 255 characters in a file name. The total path length supports up to 30,000 characters.
3 0
3 years ago
Other questions:
  • Fundamental types of data, such as strings, integers, and real numbers, are known as
    5·1 answer
  • ____ is another term for document properties.
    12·1 answer
  • What year did buck tooth bob become famous
    11·2 answers
  • Imported data that maintains a refreshable link to its external source is called ____ data.
    7·1 answer
  • Which of these is the largest?<br> terabyte<br> exabyte<br> gigabyte<br> kilobyte<br> PLEASE HELP
    5·1 answer
  • The Internet may best be compared to a/an
    11·1 answer
  • Miley met up with a bunch of her college friends after several years. She told them that she works for the sound department of a
    5·1 answer
  • What is a case in programming​
    12·1 answer
  • ____________ are designed to delete temporary files (such as deleted files still in the Recycle Bin, temporary Internet files, t
    10·2 answers
  • a company recently implemented a secure sockets layer/transport layer security (ssl/tls) version that supports secure hashing al
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!