During this activity, students should be able to:
This activity helps students develop the following skills, values and attitudes: proficiency in English, ability to analyze and synthesize, capacity to identify and solve problems, and efficient use of computer systems.
Individually or in pairs, solve the following set of problems using Python 3.4. Run and test each of your programs to make sure they work as expected.
Each source file must include at the top the authors’ personal information (student ID and name) within comments. For example:
# Authors: # A01166611 Pepper Pots # A01160611 Anthony Stark # # Description of problem being solved. # # January 28, 2015. . . (The rest of the program goes here) .
Five Star Video rents new videos for $3.00 a night, and oldies for $2.00 a night. Write a program called video.py
that the clerks at Five Star Video can use to calculate the total charge for a costumer’s video rentals. The program should prompt the user for the number of each type of video and output the total cost.
Example (user input is in blue):
Number of new videos to rent: 3 Number of old videos to rent: 5 Total charge for costumer's video rentals: $ 19
An object’s momentum is its mass multiplied by its velocity. Write a program called momentum.py
that accepts an object’s mass (in kilograms) and velocity (in meters per second) as inputs and then outputs its momentum.
Example (user input is in blue):
Object's mass in kilograms: 4.6 Object's velocity in meters per second: 1.2 The object's momentum is: 5.25 kg m/s
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. Write a program called kinetic.py
that prints the object’s kinetic energy as well as its momentum (see the previous problem).
Example (user input is in blue):
Object's mass in kilograms: 4.6 Object's velocity in meters per second: 1.2 The object's kinetic energy is: 3.312 joules The object's momentum is: 5.25 kg m/s
minutes.py
that calculates and prints the number of minutes in a year (assume that a year has 365.25 days).
light.py
that calculates and displays the value (in meters) of a light-year (assume that a year has 365.25 days).
Write a program called nautical.py
that takes as input a number of kilometers and prints the corresponding number of nautical miles. Use the following approximations:
Example (user input is in blue):
Number of kilometers: 12.5
12.5 kilometers is equal to 6.75 nautical miles.
An employee’s total weekly pay equals the hourly wage multiplied by the total number of regular hours plus any overtime pay. Overtime pay equals the total overtime hours multiplied by 1.5 times the hourly wage. Write a program called wage.py
that takes as inputs the hourly wage, total regular hours, and total overtime hours and displays an employee’s total weekly pay.
Example (user input is in blue):
Hourly wage: 7.25 Total regular hours: 35.5 Total overtime hours: 5.5 Employee's total weekly pay is: $ 317.1875
All the previous problems were taken from:
Kenneth Lambert.
Fundamentals of Python: From First Programs through Data Structures.
CENGAGE Learning, 2010.
p. 74.
Create a ZIP file called simple.zip
containing only the seven programs you wrote (video.py
, momentum.py
, kinetic.py
, minutes.py
, light.py
, nautical.py
, and wage.py
). Check this two minute Youtube video if you don’t know how to create ZIP files in Windows.
To deliver the simple.zip
file, please provide the following information:
If this activity was developed by a team of two people, only one person is required to deliver it. No activity will be accepted through e-mail or any other means.
Due date is Wednesday, January 28, all day up to midnight.
This activity will be evaluated using the following criteria:
-10 | One or more programs don’t contain within comments the authors’ personal information. |
---|---|
DA | One or more programs were plagiarized. |
10-100 | Depending on the amount of problems that were solved correctly. |