Additional Assignment You\'ve been spending so much time learning Java that you\
ID: 3590090 • Letter: A
Question
Additional Assignment You've been spending so much time learning Java that you're concerned you may miss several important dates. Write a class called Reminders that will remind you of the following dates January 1st: new year's day February 2nd: groundhog's day February 14th: valentine's day March 14th: wedding anniversary March 15th: mother's birthday April 15th: tax day July 4th: independence day October 31st halloween The program should loop through each day of each month (assume that each month has 31 days), check if the date is in the reminder list, and print a reminder message if presentExplanation / Answer
public class Reminders
{
public static void main (String args[])
{
for(int i=1;i<=12;i++) //loop to go through the months
{
for(int j=1;j<=31;j++) //loop to go through the 31 days per month
{
if (i==1 && j==1)
System.out.println("new year's day");
if (i==2 && j==2)
System.out.println("groundhog's day");
if (i==2 && j==14)
System.out.println("valentine's day");
if (i==3 && j==14)
System.out.println("wedding anniversary");
if (i==3 && j==15)
System.out.println("mother's birthday");
if (i==4 && j==15)
System.out.println("tax day");
if (i==7 && j==4)
System.out.println("independence day");
if (i==10 && j==31)
System.out.println("halloween");
}
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.