Page 649 - Computer science 868 Class 12
P. 649
10 {
11 Scanner sc= new Scanner(System.in);
12 System.out.println("Enter the Date in DD-MM-YYYY format:");
13 s= sc.next();
14 System.out.println("Enter the Day of 1st January 2019:");
15 f= sc.next();
16 }
17 void find_day()
18 {
19 int mon[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
20 String day[]={"","SUNDAY","MONDAY","TUESDAY","WEDNESDAY","THURSDAY",
"FRIDAY","SATURDAY"};
21 int d,m,y,tot=30,v=0;
22 d=sc.nextInt(substring(0,2));
23 m=sc.nextInt(s.substring(3,5));
24 y=sc.nextInt(substring(6));
25 for(int i=2;i<m;i++)
26 tot=tot+mon[i];
27 tot=tot+d;
28 tot=tot+(365*(y-2019));
29 for(int i=2022;i<=y;i=i+4)
30 tot++;
31 for(int i=o;i<=7;i++)
32 {
33 if(f.equalsIgnoreCase(day[i]))
34 {
35 v=i;
36 break;
37 }
38 }
39 if(v==0||y<2019)
40 {
41 System.out.println("Invalid Entry Parameter-EXISTING...:");
42 System.exit(0);
647
Internal Assessment 647

