Mong anh chi giup do bai tap cua minh.

Minh moi bat dau hoc java cho nen cung ko hieu nhieu lam. Minh gap mot chut kho khan ve bai lab cua minh. Mong moi nguoi chi giup
Problem Description: Generate for the following problem:
a) Test plan AND
b) Write and test the program code in Java.
 This problem will produce a time calculator.
 The program should ask for today’s and event’s dates.
 The program should calculate the time difference, and give the following (in order of priority):
 If there is no difference, display “The event is now”
 If the difference is a month or more away, display the difference in months
 If the difference is a week or more away, display the difference in weeks
 If the difference is a day or more away, display the difference in days
 If the difference is an hour or more away, display the difference in hours
 If the difference is a minute or more away, display the difference in minutes
 otherwise, display the difference in seconds
 The program must indicate if the event was in the past and not display negative values
 The program must display single unit if the value is 1 (e.g. “1 month” not “1 months”)
 The program should calculate and display the appropriate message (including proper date/time format)
 You can assume every month has 30 days.
 The output of your code must match the samples
EXACTLY. Sample Output 1:
Enter today's date and time Enter the month(1-12): 1
Enter the day(1-30): 1
Enter the hours(0-23): 1
Enter the minutes (0-59): 1 Enter the seconds (0-59): 1
Enter events's date and time Enter the month(1-12): 1
Enter the day(1-30): 1 Enter the hours(0-23): 1
Enter the minutes (0-59): 1 Enter the seconds (0-59): 1
Today: 1/1 1:01:01
Event: 1/1 1:01:01
The event is now

Sample Output 2: (Boundary case)
Enter today's date and time
Enter the month(1-12): 10
Enter the day(1-30): 7
Enter the hours(0-23): 0
Enter the minutes (0-59): 0
Enter the seconds (0-59): 0
Enter events's date and time
Enter the month(1-12): 10
Enter the day(1-30): 27
Enter the hours(0-23): 11
Enter the minutes (0-59): 59
Enter the seconds (0-59): 59
Today: 10/7 0:00:00
Event: 10/27 11:59:59
The event is 2 weeks away

Sample Output 3:
Enter today's date and time
Enter the month(1-12): 12
Enter the day(1-30): 25
Enter the hours(0-23): 17
Enter the minutes (0-59): 30
Enter the seconds (0-59): 30
Enter events's date and time
Enter the month(1-12): 10
Enter the day(1-30): 30
Enter the hours(0-23): 18
Enter the minutes (0-59): 0
Enter the seconds (0-59): 0
Today: 12/25 17:30:30
Event: 10/30 18:00:00
The event is 1 month in the past


 
Top