In: Computer Science
In each of the projects that follow, you should write a program that contains an introductory docstring. This documentation should describe what the program will do (analysis) and how it will do it (design the program in the form of a pseudocode algorithm). Include suitable prompts for all inputs, and label all outputs appropri- ately. After you have coded a program, be sure to test it with a reasonable set of legitimate inputs.
5 An object’s momentum is its mass multiplied by its velocity. Write a pro- gram that accepts an object’s mass (in kilograms) and velocity (in meters per second) as inputs and then outputs its momentum.
6 The kinetic energy of a moving object is given by the formula KE=(1/2)mv2, where m is the object’s mass and v is its velocity. Modify the program you created in Project 5 so that it prints the object’s kinetic energy as well as its momentum.
Write a program that takes as input a number of kilometers and prints the corresponding number of nautical miles. Use the following approximations:
- A kilometer represents 1/10,000 of the distance between the North Pole and the equator.
- There are 90 degrees, containing 60 minutes of arc each, between the North Pole and the equator.
- A nautical mile is 1 minute of an arc.
*please use IDLE( python 3.7)
5 An object’s momentum is its mass multiplied by its velocity. Write a pro- gram that accepts an object’s mass (in kilograms) and velocity (in meters per second) as inputs and then outputs its momentum.
python 3.7 Code
============================================================================================
mass=float(input('Enter object''s mass in kilograms: '))
velocity=float(input('Enter object''s velocity in meter per second:
'))
momentum = mass*velocity
print('Momentum is : ',momentum,'kg·m/s',)
============================================================================================
Output
============================================================================================
6 The kinetic energy of a moving object is given by the formula KE=(1/2)mv2, where m is the object’s mass and v is its velocity. Modify the program you created in Project 5 so that it prints the object’s kinetic energy as well as its momentum.
mass=float(input('Enter object''s mass in kilograms: '))
velocity=float(input('Enter object''s velocity in meter per second:
'))
momentum = mass*velocity
KE = (1/2)*mass*velocity*velocity
print('Momentum is : ',momentum,'kg·m/s',)
print('Kinetic Energy is : ',KE)
============================================================================================
Output