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
Sabiendo que z1 = 10, z2 = 20, z3 =10 , z4 = 20, n1 = 1200 rpm.
romanna [79]

Answer:

a. engranaje 1 → engranaje 2 → engranaje 3 → engranaje 4

     z1 = 10            z2 = 20              z3 =10            z4 = 20

b. n2 = 600 rpm, n3 = 1200 rpm, n4 = 600 rpm

   la relacion de transmision = 2

Explanation:

where z1 = 10, z2 = 20, z3 = 10, z4 = 20

and n1 = 1200 rpm

n2 = n1 * z1/z2 = (1200 * 10)/ 20 = 600 rpm

n3 = n2 * z2/z3 = (600 * 20)/ 10 = 1200 rpm

n4 = n3 * z3/z4 = (1200 * 10)/ 20 = 600 rpm

la relacion de transmision = z2/z1 * z3/z2 * z4/z3

= 20/10 * 10/20 * 20/10 = 2 * 0.5 * 2 = 2

7 0
3 years ago
__________ are very simple devices that connect network components, sending a packet of data to all other connected devices.
taurus [48]

Hubs are very simple devices that connect network components, sending a packet of data to all other connected devices.

Hubs are relatively basic network connectors that send a packet of data to every other connected device. Compared to a hub, a switch is more intelligent and has the ability to filter and forward data to a specific location. Within various networks, switches are utilized. Nodes of the network are any computers or printers connected to it. A network workstation is a personal computer that is linked to a network (note that this is different form the usage of the term workstation as a high-end microcomputer). Nodes of the network are any computers or printers connected to it. A network workstation is a personal computer that is linked to a network.

Learn more about network here-

brainly.com/question/24279473

#SPJ4

8 0
9 months ago
What is the best programming language
pashok25 [27]

Answer:

Ther are 8 best programming language :

• Javascript

• Swift

• Scala

• Go

• Python

• Elm

• Ruby

• C#

4 0
2 years ago
Write a program that prompts the user to enter an oligonucleotide sequence, such as TATGAGCCCGTA.
Alexxx [7]

Answer:

Explanation:

The following code is written in Python. It continues looping and asking the user for an oligonucleotide sequence and as long as it is valid it outputs the reverse complement of the sequence. Otherwise it exits the loop

letters = {'A', 'C', 'G', 'T'}

reloop = True

while reloop:

   sequence = input("Enter oligonucleotide sequence: ")

   for x in sequence:

       if x not in letters:

           reloop = False;

           break

   if reloop == False:

       break

   newSequence = ""

   for x in sequence:

       if x == 'A':

           newSequence += 'T'

       elif x == 'T':

           newSequence += 'A'

       elif x == 'C':

           newSequence += 'G'

       elif x == 'G':

           newSequence += 'C'

   print("Reverse Complement: " + newSequence)

7 0
2 years ago
Which of the following is a non timber forest product
Ronch [10]
The word youre looking for is turpentine, because you don't need to cut down the tree to collect or make it.
5 0
2 years ago
Other questions:
  • You can click a web page title on the _____ list to return to that page.
    10·1 answer
  • Describe how using active listening at work can help you be a better employee.
    15·1 answer
  • What is the chief ethical concern concerning all the new sources of data available through new technological means like internet
    9·1 answer
  • What is the main storage location of a computer
    13·1 answer
  • Browsing the web is one of the most common activities performed by individuals who use computers.
    12·1 answer
  • What is a directory server?
    5·1 answer
  • While working a night job at a call center, Eric creates an app called EatOut, which can be used to place orders at restaurants,
    14·1 answer
  • The head of small organization wants to install a network so that all the employees of different department can share various re
    14·1 answer
  • What is meant by reflection?​
    9·2 answers
  • You work part-time at a computer repair store. You're building a new computer. The customer has requested two serial ATA (SATA)
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!