Question: CalenderDate Program im needing to validate the user inputted date and should the date be invalid i must return January 1,2012 as the default date.

CalenderDate Program
im needing to validate the user inputted date and should the date be invalid i must return January 1,2012 as the default date. I also need to return the day of the week that the user inputted date lands on in string form.
CalenderDate Program im needing to validate the user inputted date and should
the date be invalid i must return January 1,2012 as the default
here is my output:
date. I also need to return the day of the week that

7 package calenderDate; 8 9 import java.util.; 10 11 public class Calender Date 12 Strine monthNome - (January", "February", "March","April", "May", "June", "uly","August", "September", "October, November December"): 15 int; 16 int da; 17 int yy: 18 private GregorianCalendar calen, 19 200 public static void main(String[] args) 21 22 Calender Date Date: 12 Scanner scan = new Scanner(System.in); 24 25 System.out.println("Please enter any valid date."): 2 int month - scan.nextInt(); 27 int day scan.nextInt(); int year - scan.nextInt(); 29 Date - new Calender Date(month,day, year); 30 31 System.out.println("Date: Oate.toStrine()); 32 System.out.println("Next Date: Date.nextDate()); System.out.println("Previous Date: Date.prevDate(); 16 System.out.println("The day of the week is: "Date.dayofweek()); 18 public Calender Date(int mint dd, int y) calen-new GregorianCalendar (yy, dd); CalenderDate.java 410 public Calender Date(int n, int da, int yy) 42 calen- new GregorianCalendar(yy.m, dd) 3 44 45 public String nextDate() 46 String next": 47 calen.add(GregorianCalendar.DAY_OF_MONTH, 1); 18 String month monthName[calen.get(Calendar.MONTH)-1]; 19 next month.".".calen.get(Calendar DAY_OF_MONTH) 1.calen.cet(Calendar. YEAR); 61 return next; 2 } 4 public String prevDate() String next:""; calen.add(GregorianCalendar.DAY_OF_MONTH, 2); String month - monthName(calen.get(Calendar.MONTH)-11 next month.",".calen.get(Calendar.DAY_OF_MONTN)".calen.set(Calendar. YEAR); return next; public Strine toString() String date": String month monthName(calen.get(Calendar. MONTH) - 1); date month",".calen.get(Calendar.DAY_OF_MONTH)+".".calen.set(Calendar. YEAR); return date; public int dayofweek) int dayofweek cxlen.set(Calendar.DAY_OF_WEEK); return dayofweek; ram Please enter any valid date. 9 24 2020 Date: September, 24,2020 Next Date: September 25, 2020 Previous Date: September, 23, 2020 The day of the week is: 6

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!