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
Calculate the ERA
Semenov [28]

Answer:

In Python:

def returnERA(runs,total):

   ERA = runs *9/total

   return ERA

Explanation:

This defines the function. It receives the number of runs and the total runs as its parameters

def returnERA(runs,total):

This calculates the ERA

   ERA = runs *9/total

This returns the ERA

   return ERA

6 0
3 years ago
If you need some one to talk to you can talk to me
Anna71 [15]

— ANSWER —

================================

oh yeah hi im boréd -,-

Explanation:

h r u

3 0
2 years ago
Read 2 more answers
What type of display allows the user to access a large amount of vocabulary in one device, uses spelling to convey the message,
katen-ka-za [31]

Answer:

Dynamic

Explanation:

As defined by Walter Woltos, DYNAMIC DISPLAY is a type of display that allows the user to access a large amount of vocabulary in one device, uses spelling to convey the message, is changeable by the user, depicts language in electronic form, uses context-based pages, and uses conversational pages.

For example, a dynamic display includes smartphones, laptops, etc. This is the opposite of Static display.

4 0
3 years ago
Write if true or false
ICE Princess25 [194]

Answer:

Formula is a sequence of cell referenced operators to do calculations.

6 0
3 years ago
I need help!!!! 1.04
Contact [7]
The answer could be all of the above
8 0
3 years ago
Other questions:
  • Which of the following is not an impact device?<br> Joy Stick<br> Track Ball<br> Mouse<br> Printer
    10·1 answer
  • Hard drives have the largest capacity of any storage device. <br> a. True <br> b. False
    6·2 answers
  • PLZ HELP ME! What is a false statement about online time?
    9·1 answer
  • Your desktop, internet explorer, and the media player can be started from this area on most computers
    9·1 answer
  • Your ___ can provide hardware firewall protection for your home network where it connects to the ISP's network, just as ISP netw
    12·1 answer
  • Respond to the following in a paragraph of no less than 125 words. Describe the steps to active listening.
    7·2 answers
  • You are writing a program to help compare two sports teams. A sample member of the list scores is [2. 5] where your team scored
    5·2 answers
  • 8.5 Edhesive Code Practice
    14·1 answer
  • IM a bit confused on what this is asking for exactly.
    14·1 answer
  • What option in the zone aging/scavenging properties dialog box will prevent dns record time stamps from being updated too often?
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!