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
When an instruction is sent to the CPU in a binary pattern, how does the CPU know what instruction the pattern means
kozerog [31]

Answer:

When an instruction is sent to the CPU in a binary pattern, how does the CPU know what instruction the pattern means

Explanation:

When the CPU executes the instructions, it interprets the opcode part of the instruction into individual microprograms, containing their microcode equivalents. Just so you know, a full assembly instruction consists of an opcode and any applicable data that goes with it, if required (register names, memory addresses).

The assembly instructions are assembled (turned into their binary equivalent 0s and 1s, or from now on, logic signals). These logic signals are in-turn interpreted by the CPU, and turned into more low-level logic signals which direct the flow of the CPU to execute the particular instruction.

8 0
3 years ago
To define constructors and member functions outside of a class's original scope, the operator can be used.
Artyom0805 [142]

Answer: Scope resolution operator(::)

Explanation: A member function and the constructor can be called within the function easily but for the execution of the these components outside the class , a special operator is required to call the functions. The scope resolution operator(::) preceding with the name of class is thus used for defining of the function outside class.This operator maintains the cope of the function and constructor outside the class.

8 0
2 years ago
Linguist study_____
-Dominant- [34]
That's B.

Linguist love all kinds of studies of languages culture writing etc.
6 0
3 years ago
Someone help me please
MA_775_DIABLO [31]

Answer:

I think it is the last 2 but i am not 100% sure.

Explanation:

3 0
3 years ago
If the value of the expression,
mr Goodwill [35]

Answer:

<u>Arithmetic underflow</u>

Explanation:

Great question, it is always good to ask away and get rid of any doubts that you may be having.

Since the answer given is a negative. We can say the error that is seen here is an <u>Arithmetic underflow </u>error. This is because the answer given is a smaller absolute value which the computer cannot actually represent or save in its memory in the CPU. Therefore this is the closest representation of the arithmetic error displayed.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

8 0
3 years ago
Other questions:
  • Timing circuits are a crucial component of VLSI chips. Here’s a simple model of such a timing circuit. Consider a complete balan
    10·1 answer
  • Choose the type of critical thinking demonstrated in the example:
    8·2 answers
  • Why would an IT technician ever have to change out a computer’s motherboard?
    5·2 answers
  • The main disadvantage of using this device is its negative impact on network performance,resulting from the fact that any incomi
    10·1 answer
  • How many bits would be in the memory of a computer with 4kb memory?
    8·1 answer
  • the technique of blocking some parts of a photograph to emphasize (or draw attention to) another part of the same photograph is
    8·1 answer
  • I WILL GIVE BRAINLIEST TO WHO ANSWERS FIRST AND CORRECTLY.
    8·1 answer
  • Write a test program that prompts the user to enter three sides of the triangle (make sure they define an actual triangle), a co
    5·1 answer
  • The maximum number of characters that a cell can contain is
    11·2 answers
  • A related database stores data in the form of______
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!