Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Task 1. Write a program that takes as input a number of kilometers and prints the corresponding number of nautical miles. Use the following approximations:

Task 1.

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.

An example of the program input and output is shown below:

Enter the number of kilometers: 100

The number of nautical miles is 54

Task # 2

Light travels at 3 108meters per second. A light-year is the distance a light beam travels in one year.

Write a program that calculates and displays the value of a light-year.

Useful facts:

  • Seconds in a year = 36524602
  • Rate = 3108meters per second

Below is an example of the correct output format:

Light travels X meters in a year.

Task # 3

Write a program that calculates and prints the number of minutes in a year.

Assume the following:

  • 1 year = 365 days (Ignore leap years)
  • 1 day = 24 hours
  • 1 hour = 60 minutes

Below is an example of the correct output format:

The number of minutes in a year is X

Task # 4

The kinetic energy of a moving object is given by the formulaKE = mv2wheremis the object's mass andvis its velocity.

Modify the program you created in Project 5 so that it prints the object's kinetic energy as well as its momentum.

Below is an example of the program input and output:

Mass: 5

Velocity: 2.5

The object's momentum is 12.5

The object's kinetic energy is 15.625

#Modifythefollowingcode

#Requesttheinput

mass=float(input("Entertheobject'smass:"))

velocity=float(input("Entertheobject'svelocity:"))

#Computetheresults

momentum=mass*velocity

#Displaytheresults

Task # 5

An object's momentum is its mass multiplied by its velocity.

Write a program that accepts an object's mass (in kilograms) and velocity (in meters per second) as inputs, and then outputs its momentum.

Below is an example of the program input and output:

Mass: 5

Velocity: 2.5

The object's momentum is 12.5

Task # 6

Write a program that takes the radius of a sphere (a floating-point number) as input and then outputs the sphere's:

  1. Diameter (2 radius)
  2. Circumference (diameter )
  3. Surface area (4 radius2)
  4. Volume (4/3 radius3)

For convenience, the program can import themathmodule.

Below is an example of the program input and output:

Radius = 5

Diameter: 10.0

Circumference: 31.41592653589793

Surface area : 314.1592653589793

Volume: 523.5987755982989

Task # 7

Five Star Retro Video rents VHS tapes and DVDs to the same connoisseurs who like to buy LP record albums. The store rents new videos for$3.00a night, and oldies for$2.00a night.

Write a program that the clerks at Five Star Retro Video can use to calculate the total charge for a customer's video rentals.

The program should prompt the user for the number of each type of video and output the total cost.

An example of the program input and output is shown below:

Enter the number of new videos: 3

Enter the number of oldies: 2

The total cost is $13.0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transport Operations

Authors: Allen Stuart

2nd Edition

978-0470115398, 0470115394

Students also viewed these Programming questions