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]
2 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:
posledela2 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
HELP PLEASE!! WILL MARK FIRST AND MOST RELIABLE ANSWER BRAINLIEST!!~~~~What is the primary difference between sort and filter?
tatiyna

Answer:

A

Explanation:

Example: when scrolling through a list of shows, if you filter for action shows, only shows that match the action description would appear

3 0
3 years ago
A computer has many resources. A resource can be memory, disk drive, network bandwidth, battery power, or a monitor. It can also
bekas [8.4K]

Answer:

The security principle being referred to here is:

Resource Encapsulation.

Explanation:

Resource Encapsulation is one of the cybersecurity first principles.  It allows access or manipulation of the class data as intended by the designer. The cybersecurity first principles are the basic or foundational propositions that define the qualities of a system that can contribute to cybersecurity.  Other cybersecurity first principles, which are applied during system design, include domain separation, process isolation, modularization, abstraction, least principle, layering, data hiding, simplicity, and minimization.

7 0
3 years ago
What is known as the global network of computers?
Rudik [331]

Answer:

b. internet

Explanation:

cuz just b

7 0
2 years ago
Read 2 more answers
Plz answer in order so like the the nitrogen bacteria is-
Nastasia [14]

Answer:

Nitrogen-fixing bacteria, microorganisms capable of transforming atmospheric nitrogen into fixed nitrogen.

Explanation: I hope this helps! (。^▽^)

6 0
2 years ago
Read 2 more answers
What is the result when you run the following program?
TiliK225 [7]

Answer:

C

Explanation:

6 0
2 years ago
Read 2 more answers
Other questions:
  • 6. Which of the following is malware? (1 point)
    15·2 answers
  • What does the following code do? Assume list is an array of int values, temp is some previously initialized int value, and c is
    15·2 answers
  • 3. A vulnerability is: a. A hacker searching for open ports b. A known attack method c. An incorrectly implemented policy d. All
    7·1 answer
  • What are computer virus ? Explain in detail.In your answer include symptoms and prevention (3each)
    10·1 answer
  • When including multiple images in a report, it may help to create a _____ on each image so you can cross reference them througho
    11·1 answer
  • What does f.i.r.s.t stand for in robotics
    15·1 answer
  • What can be defined as in information technology environment?
    14·2 answers
  • A technician is buying a PC that will host three VMs running at the same time with the current configuration. The technician bel
    5·1 answer
  • What symbol is used for an assignment statement in a flowchart?
    8·1 answer
  • A good algorithm should have which three components?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!