Question

Instructions Hopefully you will get to travel outside of the USA at some point if you...


Instructions

Hopefully you will get to travel outside of the USA at some point if you have not done so already. You will notice that most other countries use metric measures while the US continues to use the imperial system of measurement. In a foreign country, you will see speed limits in kilometers per hour instead of miles per hour. In this program, you are to make a conversion table that increments by 5 miles per hour. The table will show the kilometer per hour to the nearest whole number. For example:
MPH KPH
0                 0
5                 8
10              16
15              24
20             32
          :
          :
90             145
95             153

The distance range should go from 0 MPH to 200 MPH incrementing by 5 MPH.

Homework Answers

Answer #1

** REMEBER 1 MILE PER HOUR (MPH) IS EQUIVALENT TO 1.60934 KILOMETER PER HOUR (KPH)

YOU WILL GET A KMPH VALUE BY SIMPLY MULTIPLYING MPH VALUE WITH 1.60934 .

PROGRAM FOR CONVERSTION OF MPH INTO KMPH :

PYTHON :

import math
def convertmphtokmph(mph): 
    kmph = math.floor(mph * 1.60934) 
    return kmph 
print("mph",end = "\t")
print("kmph")
for i in range(0,201,5):
    print(i,end="\t")
    print(convertmphtokmph(i))

OUTPUT :

JAVA :

import java.io.*;
class Conversion {  
    static double convertmphtokmph(double mph) 
    { 
        return mph * 1.60934; 
    } 
   
    public static void main(String[] args) 
    { 
         System.out.println("mph \t kmph");    
         for(int i=0;i<=200;i+=5){ 
             System.out.println(i+"\t"+ (int)(java.lang.Math.floor(convertmphtokmph(i))));
                 
    } 
} 
}

OUTPUT:

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT