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
liraira [26]
3 years ago
10

C++

Computers and Technology
2 answers:
egoroff_w [7]3 years ago
5 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:

Cerrena [4.2K]3 years ago
4 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.

 

You might be interested in
What is the cell reference for the cell located in the second column and fifth row of a worksheet?
Lena [83]
Its perhaps B2
HOPE THIS HELPS
8 0
3 years ago
In the history of Social Media what are two points that stood out?
Naddik [55]
People post happy moments and don't show the other sides to them
some believe their value comes from likes
3 0
3 years ago
Name 3 examples of operating system software that are not Windows based.
anyanavicka [17]
Ubuntu, Linux, and Mint
4 0
3 years ago
Drag each statement to the correct location.
VMariaS [17]

Answer:

(a)\ 222_{10} = DE_{16} --- True

(b)\ D7_{16} = 11010011_2 --- False

(c)\ 13_{16} = 19_{10} --- True

Explanation:

Required

Determine if the statements are true or not.

(a)\ 222_{10} = DE_{16}

To do this, we convert DE from base 16 to base 10 using product rule.

So, we have:

DE_{16} = D * 16^1 + E * 16^0

In hexadecimal.

D =13 \\E = 14

So, we have:

DE_{16} = 13 * 16^1 + 14 * 16^0

DE_{16} = 222_{10}

Hence:

(a) is true

(b)\ D7_{16} = 11010011_2

First, convert D7 to base 10 using product rule

D7_{16} = D * 16^1 + 7 * 16^0

D = 13

So, we have:

D7_{16} = 13 * 16^1 + 7 * 16^0

D7_{16} = 215_{10}

Next convert 215 to base 2, using division rule

215 / 2 = 107 R 1

107/2 =53 R 1

53/2 =26 R1

26/2 = 13 R 0

13/2 = 6 R 1

6/2 = 3 R 0

3/2 = 1 R 1

1/2 = 0 R1

Write the remainders from bottom to top.

D7_{16} = 11010111_2

<em>Hence (b) is false</em>

(c)\ 13_{16} = 19_{10}

Convert 13 to base 10 using product rule

13_{16} = 1 * 16^1 + 3 * 16^0

13_{16} = 19

Hence; (c) is true

7 0
2 years ago
What job does a front-end developer perform?
alina1380 [7]

Answer:

They manage making websit/es beautiful. Basically how brainly is setup? The layout is nice? Front end developers are responsible for why webpages look pretty or nicely done. <em>fun fact, my dream job is a front end developer!</em>

5 0
2 years ago
Other questions:
  • Directions Use your imagination and a word processor to write a business letter with two to three paragraphs. Your business lett
    5·1 answer
  • A ___ is the basic collective unit of data in a computer.
    12·1 answer
  • Explain the nature of documents that can be suitable for mergin
    12·1 answer
  • Quiz
    6·2 answers
  • You need to install an operating system on a computer that will be sharing files for the company employees. You estimate there w
    9·1 answer
  • When mapping a drive, you can type in the path to the shared folder on the host computer. what is the syntax for the path?
    7·1 answer
  • Suppose a host has a 1-MB file that is to be sent to another host. The file takes 1 second of CPU time to compress 50%, or 2 sec
    12·1 answer
  • A type of multiprocessor chip that provides two or more separate and independent CPUs.
    8·1 answer
  • Which of the following tools helps ensure your document will open in older versions of word
    13·1 answer
  • What are the two most common input and output devices?
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!