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
I love python. it be a good programming language...........................................
OLga [1]

Answer:

true

Explanation:

5 0
3 years ago
A professor is working with five teams in his marketing research class. He decides to experiment with path-goal theory in helpin
ludmilkaskok [199]

Answer:

A) an instrumental style

Explanation:

Based on the information provided within the question it can be said that with Group A the professor seems to be using an instrumental style. This is a specific style of communication which is goal oriented and sender focused. This seems to be the style being used since the professor gets them to seek out and produce an even better project than the one they did last time in order to impress the professor (sender).

6 0
4 years ago
You have just set up a new wireless network at your house, and you want to determine whether your Linux laptop has connected to
Anvisha [2.4K]

Answer:

ifconfig -a

Explanation:

ifconfig is used to configure the system's kernel-resident network interfaces. It is used at boot time to set up interfaces as necessary. After that, it is usually only needed when debugging, or when system tuning is needed. If no arguments are given, ifconfig displays the status of the system's active interfaces.

-a display all interfaces which are currently available, even if down. source manpages: ifconfig.

8 0
3 years ago
Bubbles are seen in the sight glass of an R-12 system. Technician A says this that indicates a fully charged system. Technician
Genrish500 [490]

Answer:

Technician B says that it indicates an empty system, the bubbles being caused by vapor left in the system.

Explanation:

Bubbles mean that the R-12 system is low in charge or an empty system, and the bubbles being caused by the vapor which is left in the system. The bubbles are the indication of low charge or an empty system. And hence, here Technician B seems to be the correct person, and hence the correct choice here is Technician B.

5 0
3 years ago
What feature is available to add a suggestion in the margin of someone else's document? Annotation Bookmark Comment Highlight
Step2247 [10]
Comment i think is the answer
4 0
4 years ago
Read 2 more answers
Other questions:
  • You can deselect multiple selected sheets beginning with the sheet1 tab by pressing the ____ key and clicking the sheet1 tab.
    15·1 answer
  • Jamie works on a spread sheet in which he has to label stes of data. How can he navigate between the cells in the spread sheet
    8·1 answer
  • Memory management is concerned with __________.
    14·1 answer
  • How a hard drive works
    8·1 answer
  • How do you view a presentation as your audience would see it?
    14·2 answers
  • How has information technology made piracy possible
    14·1 answer
  • In this project you will demonstrate your knowledge of decision making blocks such as if statements. Objectives Building on ever
    11·1 answer
  • Write a program that asks the user to enter the size of a triangle (an integer from 1 to 50). Display the triangle by writing li
    14·1 answer
  • What is the cheapest way to add more USB ports to your computer?
    14·1 answer
  • Five real world objects with similar characteristics​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!