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
enot [183]
3 years ago
7

Write a function so that the main program below can be replaced by the simpler code that calls function mph_and_minutes_to_miles

(). Original main program: miles_per_hour = float(input()) minutes_traveled = float(input()) hours_traveled = minutes_traveled / 60.0 miles_traveled = hours_traveled * miles_per_hour print('Miles: %f' % miles_traveled) Sample output with inputs: 70.0 100.0 Miles: 116.666667
Computers and Technology
1 answer:
Blababa [14]3 years ago
4 0

Answer:

Here is  code in python .

#function to calculate miles traveled

# pass two parameter in the function "miles_per_hour" and "minutes_traveled"

def mph_and_minutes_to_miles(miles_per_hour, minutes_traveled):

# convert minutes to hours

   hours_traveled = minutes_traveled / 60.0

   #calculate total miles traveled

   miles_traveled = hours_traveled * miles_per_hour

   #return the value

   return miles_traveled

#read input from user

miles_per_hour = float(input())

minutes_traveled = float(input())

#call the function and print the output

print('Miles: %f' % mph_and_minutes_to_miles(miles_per_hour, minutes_traveled))

Explanation:

Read the value of "miles_per_hour" and "minutes_traveled" from user. call the function mph_and_minutes_to_miles() with those two parameters.calculate total hours from the minutes_traveled by dividing it with 60. then calculate the total miles by multiply hours_traveled * miles_per_hour. then return the miles travelled.

Output:

20                                                                                                                        

150                                                                                                                        

Miles: 50.000000

You might be interested in
Write a file path for a document file that is saved on the F drive then a folder called homework, then a folder called math. The
ad-work [718]
F:\homework\math\<span>fraction_hw.docx</span>
7 0
3 years ago
Each of the following programs has errors. Find as many as you can. 65. // Find the error in this program. #include using namesp
Serggg [28]

Answer:

There are two error in this program--

  1. In header file inclusion, file is not defined.
  2. In the statement "result = ++(num1 + num2);" , bracket is fixed after the increment operator.

Explanation:

  • For the first error, the user needs to add the file because "#include" is used to add the library for the program which states about the function and symbols used in the program.
  • The second error is because there must be a variable with the increment operator ( increment operator is being used to increase the value of a variable by 1), but there is a small brace fix in between the operator and operands.
7 0
4 years ago
Mike wants to build an amplifier. Which technology can he use?
RSB [31]

Answer: The component that is used for most amplifiers is the transistor. Semiconductors like gold,copper etc. are used although poor semiconductors like silicon are sometimes used as well. There are many electronic circuits that all under the amplifier category. The classification of an amplifier depends on the size of the signal and configuration.

8 0
3 years ago
You’ve received a tarball called data79.tar from a colleague, but you want to check the names of the files it contains before ex
Nina [5.8K]

Answer:

D. tar rvf data79.tar

4 0
3 years ago
How do I start a private conversation?
11111nata11111 [884]
What I do is just Play casual act like they did something and then when they say they didn’t just say oh OK sorry for blaming you and then you guys will start getting to know each other
6 0
3 years ago
Read 2 more answers
Other questions:
  • Apps are A. small, downloadable software programs that can run on tablet devices or smartphones. B. programs that can be used to
    11·1 answer
  • The outstanding disk requests are for tracks 6,10,4,20,36,8, and 40 in that order. Assume that the seek time speed is 5 msec/tra
    14·1 answer
  • A sample containing 4.30 g of O2 gas has an initial volume of 13.0 L. What is the final volume, in liters, when each of the foll
    5·1 answer
  • The amount of vertical space between lines within paragraphs
    9·1 answer
  • Why is the wizard able to install the printer when an actual print device is not connected to the computer??
    11·1 answer
  • 1. Why was the Internet created?
    8·1 answer
  • TolTel Inc., an information technology firm, has created a network that allows its employees to easily access, share, and publis
    11·1 answer
  • Richard Palm is the accounting clerk of Olive Limited. He uses the source documents such as purchase orders, sales invoices and
    12·1 answer
  • Layers allow you to work with one element of an image without disturbing the others true or false​
    15·1 answer
  • Question 7 of 25
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!