CSc 2310 Principles of Computer Programming I
Spring 1999
Programming Assignment #2
Due: 15 February 1999 (Monday)
- Write a Java program that reads in two times, an earlier
time and a later time, and prints the difference in
time in minutes as well as in hours/minutes. The format of the
time is HH:MMAM or H:MMAM or HH:MMPM or H:MMPM. Also the AM
or PM may be in lower case. A sample run of the program is
shown below:
C:\2310> java time
Enter Earlier Time: 9:36aM
Enter Later Time: 6:22PM
Number of minutes between 9:36aM and 6:22PM = 526
The time difference between 9:36aM and 6:22PM = 8 hours and 46 minutes.
C:\2310>
The formatting of the output should be exactly as shown above.
Points will be deducted if the output does not conform to the
format shown. This program should be called
Time.java.
- Write a Java program that draws a scene containing a
house, a tree, and a sun. Each of the items should be labeled
with the name and your name should be included at the bottom of the
artwork. You should use different colors to
fill the various shapes in the artwork.
A sample drawing is shown below. This program should
be called Art.java.