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
The Moon appears to be red in color during a total lunar eclipse because of the way light waves pass through Earth’s ___________
Marysya12 [62]

Answer bro must have a mental disorder its like ur thumb HEAT WAVES the  moon becomes red bc of heat waves didnt u say that anyways???

Explanation:

8 0
1 year ago
Read 2 more answers
The best reason for using Independent software test teams is that
Kobotan [32]
The answer is B) A test team will test the software more thoroughly
4 0
3 years ago
Can someone please do a java computer science program for me? I’m desperate and I did not have enough time to learn the topic. I
vagabundo [1.1K]
Sure, how would you like me to send you the code?
5 0
2 years ago
With which of these enterprise platform businesses does Accenture hold a partnership?
prohojiy [21]

Answer: SAP and Salesforce.

Explanation:

Accenture's partnership with SAP and Salesforce is vital in helping clients progress toward the achievement of their environmental, social, and governance goals.

The partnership will help combine Salesforce Sustainability Cloud with the consulting practice of Accenture’s Sustainability Services. With this partnership, companies can embed sustainability into their business as companies are advised on how to move to low carbon energy, and cloud na how these can help improve their business.

5 0
3 years ago
Create a stack with three integers and then use .toarray to copy it to an array.
Marizza181 [45]

Answer:

import java.util.*;

import java.lang.*;

import java.io.*;

class Codechef

{

public static void main (String[] args)

{

    Stack<Integer> mat=new Stack<Integer>();

    mat.add(1);

    mat.add(3);

    mat.add(6);

    System.out.println(mat);

    Object [] a=mat.toArray();

    for(int i=0;i<a.length;i++)

    System.out.println(a[i]);

}

}

Explanation:

An integer type stack st is created;

1,3 and 6 are added to the stack.

printing the contents of the stack.

array a is created form the stack using toArray().

Then printing the array.

6 0
3 years ago
Other questions:
  • James is planning to expand his DTP business. He has most of the basic DTP hardware and software components, but now he wants to
    12·2 answers
  • write an application to presell a limited number of cinema tickets. each buyer can buy as many as 4 tickets. No more than 100 ti
    8·1 answer
  • What are the advantages of renting a home over buying a home? What are some disadvantages?
    13·1 answer
  • To reboot a pc, hold down the ____ keys at the same time.
    15·1 answer
  • The desktops of computers running the same OS all look the same
    8·1 answer
  • Why is it important for software developers to study Human-Computer Interaction? to make sure a user interface is easy to use, w
    10·2 answers
  • Create a conditional expression that evaluates to string "negative" if userVal is less than 0, and "non-negative" otherwise. Ex:
    11·1 answer
  • 9. "मेरे तो गिरधर गोपाल, दूसरो ना कोई
    5·1 answer
  • Mingji is working to transfer photos from her digital camera to her computer. While
    11·1 answer
  • What is the difference between RELIABLE and UNRELIABLE sources of<br> income?
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!