Sei sulla pagina 1di 2

INTRODUCTORY PROGRAMMING ASSIGNMENTS

A.

Write a program that gets, from the user, the number of hours,
minutes and seconds that have passed. The program should
calculate the total number of seconds that have passed. SAVE
AS TimeSeconds.
Sample Input
Hours
Minutes
Seconds
Output
0
2
14
134 seconds
1
0
10
3610 seconds
2
15
45
8145 seconds

B.

Write a program that gets, from the user, the total number of seconds that
have elapsed. The program should calculate the total number of hours,
minutes and seconds. SAVE AS SecondsTime
Sample Inputs
Seconds
98
12767

C.

Output
0 hour(s) 1 minute(s) 38 second(s)
3 hour(s) 32 minute(s) 47 second(s)

Write a program that gets, from the user, two points on a graph. The
program should calculate the distance between the two points. SAVE AS
DistanceFormula

Sample Inputs
Point 1
0 0
1 5

Point 2
1 8
3 45

Distance Between
8.062
40.05

D.

Write a program that gets, from the user, the radius of a sphere. The
program should calculate the area and the volume. SAVE AS SphereRadAre.

Sphere Surface Area = 4 r


Sphere Volume = 4/3 r
Sample Inputs
Radius
Area
5
314.16
3.25
132.73

Volume
523.6
143.79

E.

Write a program that gets, from the user, the total number of cents that a
person had. The program should calculate how many $10 bills, $5 bills, $1
bills, quarters, dimes, nickels, and pennies the person would have. SAVE AS
MoneyCoins.
Sample Inputs
Cents
Output
752
0 $10 bill(s) 1 $5 bill(s) 2 $1 bill(s) 2
quarter(s) 0 dime(s) 0 nickel(s) 2 pennies
1245
1 $10 bill(s) 0 $5 bill(s) 2 $1 bill(s) 1
quarter(s) 2 dime(s) 0 nickel(s) 0 pennies

F.

Write a program that gets, from the user, their height given in feet and
inches. The program should calculate how tall they are in centimeters. SAVE
AS HeightToMetric.
Sample Inputs
Feet
Inches
Metric Centimeters
5
4
162.56 centimeters
4
10.5
148.59 centtimeters

G.

Write a program that gets, from the user, total number of books that are
overdue and the number of days that they are overdue. The program should
calculate the library fine based on $0.05 per day per book. SAVE AS
LibraryFine.
Sample Inputs
Books
Days
Fines
2
5
$0.50
7
12
$4.20
10
50
$25.00

Potrebbero piacerti anche