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
ad-work [718]
3 years ago
11

C++

Computers and Technology
2 answers:
Sonbull [250]3 years ago
8 0

Answer:

#include <iostream>

#include<iomanip>

using namespace std;

double DrivingCost(double drivenMiles, double milesPerGallon, double dollarsPerGallon)

{

  double dollarCost = 0;

  dollarCost = (dollarsPerGallon * drivenMiles) / milesPerGallon;

  return dollarCost;

}

int main()

{

  double miles = 0;

  double dollars = 0;

  cout << "Enter miles per Gallon   : ";

  cin >> miles;

  cout << "Enter dollars per Gallon: ";

  cin >> dollars;

  cout << fixed << setprecision(2);

  cout << endl;

  cout << "Gas cost for 10 miles : " << DrivingCost(10, miles, dollars) << endl;

  cout << "Gas cost for 50 miles : " <<DrivingCost(50, miles, dollars) << endl;

  cout << "Gas cost for 400 miles: "<<DrivingCost(400, miles, dollars) << endl;

  return 0;

}

Explanation:

  • Create a method definition of DrivingCost that accepts  three input double data type parameters drivenMiles,  milesPerGallon, and dollarsPerGallon and returns  the dollar cost to drive those miles .
  • Calculate total dollar cost and store in the variable, dollarCost .
  • Prompt and read the miles and dollars per gallon  as input from the user .
  • Call the DrivingCost function three times  for the output to the gas cost for 10 miles,  50 miles, and 400 miles.

 

Romashka [77]3 years ago
7 0

Answer:

def driving_cost(driven_miles, miles_per_gallon, dollars_per_gallon):

  gallon_used = driven_miles / miles_per_gallon

  cost = gallon_used * dollars_per_gallon  

  return cost  

miles_per_gallon = float(input(""))

dollars_per_gallon = float(input(""))

cost1 = driving_cost(10, miles_per_gallon, dollars_per_gallon)

cost2 = driving_cost(50, miles_per_gallon, dollars_per_gallon)

cost3 = driving_cost(400, miles_per_gallon, dollars_per_gallon)

print("%.2f" % cost1)

print("%.2f" % cost2)

print("%.2f" % cost3)

Explanation:

You might be interested in
In the excerpt above, what can be inferred by the statement, “The Dillingham had been flung to the breeze during a former period
galina1969 [7]
The best and the most correct answer among the choices provided by the question is the first choice. We can infer from the excerpt that <span>Jim felt important enough to place his full name on the mailbox when he enjoyed a higher income. </span>I hope my answer has come to your help. God bless and have a nice day ahead!
3 0
2 years ago
Read 2 more answers
Before we can use the PS Session to remotely manage a target system, there are certain tasks we must perform, such as create exc
Illusion [34]

Answer:

B. Enable-PSRemoting.

Explanation:

Powershell is a command-line interface software used in windows operating system to manage the operations of the system. It is similar to the bash terminal scripting language in Linux and has some of the command prompt features.

The PS session is used to manage remote systems connected wirelessly to the administrative system. The command used to enable this process is "Enable-PSRemoting".

4 0
3 years ago
____ is an integrated system that collects and processes data and manages and coordinates resources, information, and functions
miss Akunina [59]

Answer:

a.) Enterprise Resource Planning  

Explanation:

5 0
3 years ago
Binary tree algorithm?
Mrac [35]
My answer is attached.....

good luck.

5 0
2 years ago
7 Annie must pay in taxes to the state<br> government on her investment.
svetoff [14.1K]

Answer:

is that the question?

Explanation:

6 0
3 years ago
Read 2 more answers
Other questions:
  • Retail price data for n = 60 hard disk drives were recently reported in a computer magazine. Three variables were recorded for e
    13·1 answer
  • Which of the following are characteristics of a good webmail message select all that apply
    14·1 answer
  • How is a recession determined?
    10·1 answer
  • Which of the following is an example of hypertext pattern reading?
    13·1 answer
  • Which type of development metrics does Instagram most improve when it releases an update in the App Store to fix errors its cust
    15·1 answer
  • What does this result prove about the computer’s network connectivity?
    12·1 answer
  • NumA = 3 <br>numB = 2<br>Result = numA ** numB
    12·1 answer
  • ______ behavior expected from every professional​
    12·1 answer
  • You are setting up a home network for your friend. She has students visiting her home regularly for lessons and wants to provide
    14·1 answer
  • Using complete sentences post a detailed response to the following.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!