Posted: February 4th, 2015
Java Application 1 – RandomDate
Using NetBeans
Create a java application to build and display a random date between January 1, 1900 and December 31, 2014 inclusive. Retrieve a random year, month, and day. The
maximum day is determined by the month. Recall that April, June, September, and November have only 30 days. If the month is February, the maximum day is 28 unless it
is a leap year in which case the maximum day is 29.
Display the date twice as follows:
Random Date is: 10/3/2000
Formatted date: October 3rd, 2000
Note that the day is followed by ‘st’, ‘nd’, ‘rd’, or ‘th’
Here are some examples of valid dates for the display:
Random Date is: 5/6/1978
Formatted date: May 6th, 1978
Random Date is: 4/22/1921
Formatted date: April 22nd, 1921
Random Date is: 8/1/1987
Formatted date: August 1st, 1987
HINT: You must retrieve a year and month before you can retrieve a random day. Since the maximum day that can be retrieved is dependent on the month, and if the
month is February, the maximum day can be 29 if it is leap year.
Name the Java Class: RandomDate
Grading Rubric
· Correct File Name (RandomDate.java) – case sensitive
· Correct Class Name (RandomDate) – case sensitive
· Correct Style – comments
· Correct Style – indentation
· Correct Style – White Space
· Free of syntax errors
· Variables to hold year, month, and day
· Retrieve year in correct range
· Retrieve month in correct range
· Retrieve day in correct range determined by month and year
· Display date in correct format
PLACE THIS ORDER OR A SIMILAR ORDER WITH US TODAY AND GET AN AMAZING DISCOUNT 🙂
Place an order in 3 easy steps. Takes less than 5 mins.