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
Ket [755]
2 years ago
11

Write a program to display MPH (Miles per Hour). Create a function to calculate the MPH. Ask the user for the number of miles dr

iven and the number of minute it took to drive that many miles. Validate that both the number of miles and the number of minutes is a positive, non-zero number. Pass both the number of miles and the number of minutes to the function, and have the function return the MPH.
Computers and Technology
1 answer:
puteri [66]2 years ago
7 0

Answer:

In Python:

def MPH(miles,minutes):

   mph = round(60 * miles/minutes,1)

   return mph

   

miles = float(input("Miles: "))

minutes = float(input("Minutes: "))

if miles>0 and minutes>0:

   print("MPH: ",MPH(miles,minutes))

else:

   print("Positive inputs only")

Explanation:

This defines the function

def MPH(miles,minutes):

This calculates mph rounded to 1 decimal place

   mph = round(60 * miles/minutes,1)

This returns the calculated mph

   return mph

The main begins here

This gets input for miles    

miles = float(input("Miles: "))

This gets input for minutes

minutes = float(input("Minutes: "))

If miles and minutes are positive

if miles>0 and minutes>0:

This calls the MPH function

   print("MPH: ",MPH(miles,minutes))

If otherwise, this prompts the user for positive inputs

<em>else:</em>

<em>    print("Positive inputs only")</em>

You might be interested in
Wirte a program which asks the users to input length and calculates the area of a square.( Area = Length^2)​
kogti [31]

Explanation:

i hope this will help you

3 0
2 years ago
Consider the code below. Note that the catch statements in the code are not implemented, but you will not need those details. As
Dmitriy789 [7]

Missing Part of Question

An exception raised by the instruction in i3 would be caught by the catch statement labeled?

Answer:

e3 and e4.

Explanation:

The instruction tag i3 points to the following code segment

a[++i] = (double) (1 / x); // i3

The code segment above performs arithmetic operation (double)(1/x)

And then assigns the value of the arithmetic operations to an array element a[++I]

It's possible to have one or both of the following two exceptions.

1. Error in Arithmetic Operation

2. Index of Array out of bound

These are both represented in exception tags e3 and e4

catch (ArithmeticException ex) {...} // e3

catch (ArrayIndexOutOfBounds ex) {...} // e4

Exception e3 can arise when the program try to carry out invalid arithmetic operation.

For instance, 1/0 or 0/0.

This will lead to ArithmeticException to be thrown

Exception e4 can arise when the program tries to assign values to an index that's not in an array.

Say, the total index in a given array a is 5.

The index of this array is 0 to 4; i.e. a[0] to a[4]

The moment the program tries to assign values to array element other than the ones I listed above (e.g a[5]) ArrayIndexOutOfBounds exception will be thrown

6 0
3 years ago
Camille prepared excellent PowerPoint slides for her speech about education reform, but the speech didn't go as well as she had
Elanso [62]

Answer:

The answer is "she uses the keyboard unless she could quickly progress the slides".

Explanation:

Planning is the single least key aspect of having the performance effectively. It is a critical foundation and which can dedicate much space as possible to it and avoids loopholes.  

  • It is the proper planning that may also ensure, that you have fully considered.  
  • It is the thing, which we need to convey into your delivery and will also help to boost your trust.
6 0
3 years ago
daniel wants to buy a computer to use for playing games after work. he loves racing games and wants to make sure his device has
kirza4 [7]

The factors which should be considered by Daniel are the RAM capacity and the Processor Core of the computer.

Computer games especially racing and football games are usually memory intensive and as such will require a good amount of RAM in other to ensure that the game runs smoothly as the RAM provides a temporary storage required for applications or programs to run smoothly.

Also, the processor core has to be put into consideration, Daniel will need a multi - core processor in other to aid the smooth running of his racing game.

Therefore, the factors that should be considered are the RAM and processor core.

Learn more :brainly.com/question/25010930

5 0
2 years ago
What's your opinion on Pokemon​ and pixeldip
faust18 [17]

Answer:

Its a good game but an amazing show. 10/10

Explanation:

7 0
2 years ago
Other questions:
  • George is a contractor who creates websites and web applications. What is George working as?
    7·2 answers
  • To increase the view of a document on the screen, use the _____. View icon Zoom slider full-screen reading boldface font
    9·1 answer
  • Renee is creating a multimedia presentation for a website that requires user interaction. Which multimedia type is Renee using?
    5·2 answers
  • I’m trying to get answers from Brainly and it’s not showing up. I’ve been refreshing the browser, but it’s the same. I’ve never
    10·2 answers
  • William wants to create a document using a DTP<br> what time saving techniques can he use?
    9·1 answer
  • The arguments in a method call are often referred to as ____ . The variables in the method declaration that accept the values fr
    10·1 answer
  • The data-mining technique that creates a report or visual representation is _____.
    13·1 answer
  • What feature should be used before a document is printed
    8·1 answer
  • Write a program that asks the user to provide a word, validate that it is a word, and print the word.
    6·1 answer
  • ____________________________ and _________________________ are 2 positive impacts of the internet on businesses.
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!