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
1. Which of the following describes a way of memorizing a poem using a mnemonic device?
xenn [34]

Answer:

Singing the words of the poem to the tune of Happy Birthday"

Explanation:

Mnemonic devices are those tools which can be used to improve a persons ability to remember something efficiently. In short, it a technique to memorize something in short period of time and remember it for longer period of time.

Memorizing a poem by singing it to the tune of Happy birthday is also a technique to remember the poem and memorizing it efficiently.

3 0
3 years ago
A(n) ________ is a heavily secured server located between a company's secure internal network and its firewall. bastion host tra
devlian [24]

Answer: Bastion host

Explanation: Bastion host is type of computer which resist the attacks happening on a network particularly. It mostly works between the internet and interior network. It assures that the interior computer network remains undamaged due to any type of threat. It can also be considered that bastion host behave as the gateway between internal network and firewall as well.

4 0
3 years ago
The addresses a program may use to reference memory are distinguished from the addresses the memory system uses to identify phys
antiseptic1488 [7]
I can answer this but I need to know if it is a question because theres no question mark
8 0
3 years ago
What is the default view in a Word document?
boyakko [2]
Wouldn’t be A, C. When editing a word document it would be B and when just opening one from someone it would be D. This question doesn’t give a brief explanation of what’s happening. Can you give more information or is that all of the question?
3 0
2 years ago
True or False? To reduce hazards, flexible cords must connect to devices and fittings in ways that prevent tension at joints and
anastassius [24]
<span>It can be true and is really necessary for this type of things when fittings in ways that prevent tension at joints and terminal screws. So, Flexible cords are finely stranded for flexibility, so straining a cord can cause the strands of one conductor to loosen from under the many joints.</span>
5 0
3 years ago
Other questions:
  • Select the proper ergonomic keyboarding techniques.
    9·1 answer
  • ____ are systems in which queues of objects are waiting to be served by various servers
    5·1 answer
  • What type of organizational structure would you want to use for this company (by function, by process, by product, and so on)? E
    11·1 answer
  • Describe how you believe technology will impact our society in 50 years.
    6·1 answer
  • The next four octal numbers after 36 is:________.
    10·1 answer
  • Which of the following is NOT one of the Big 3 Google Applications that we discussed?
    9·2 answers
  • Pls help have absolutely no clue how to delete this
    12·2 answers
  • Ed says that no matter how carefully he checks his CSS code and HTML markup, and has validated his document at the W3C Markup Va
    6·1 answer
  • Which layer in the Transmission Control Protocol/Internet Protocol (TCP/IP) model is responsible for delivering data between two
    12·1 answer
  • Explain briefly the use of the computers in the advertising area​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!