public static void noOfDaysInMonth(){
System.out.println("Enter the month");
Scanner scanner = new Scanner(System.in);
String month = scanner.next();
System.out.println("Enter the year");
int year = scanner.nextInt();
String[] months = {"january","febrary","march","april","may","june","july","aguest","septemper","october","november","december"};
for(int i = 0; i<months.length;i++){
if(month.equals(months[i])){
switch(i){
case 0:
System.out.println("no of days 31");
break;
case 1:
System.out.println("no of days 29");
break;
case 2:
System.out.println("no of days 31");
break;
case 3:
System.out.println("no of days 30");
break;
case 4:
System.out.println("no of days 31");
break;
case 5:
System.out.println("no of days 30");
break;
case 6:
System.out.println("no of days 31");
break;
case 7:
System.out.println("no of days 31");
break;
case 8:
System.out.println("no of days 30");
break;
case 9:
System.out.println("no of days 31");
break;
case 10:
System.out.println("no of days 30");
break;
case 11:
System.out.println("no of days 31");
break;
}
}
}
}
public static void listOfHolidays(){
String[] JANUARY = {"New Year","Pongal","Republicday"};
String[] FEBRARY = {"No Holiday in this month"};
String[] MARCH = {"No Holiday in this month"};
String[] APRIL = {"No Holiday in this month"};
String[] MAY = {"LaboursDay"};
String[] JUNE = {"No Holiday in this month"};
String[] JULY = {"No Holiday in this month"};
String[] AUGEST = {"Independents days"};
String[] SEPDEMBER = {"Diwali"};
String[] OCTOBER = {"No Holiday in this month"};
String[] NOVEMBER = {"Ramjan"};
String[] DECEMBER = {"Christmas"};
System.out.println("enter the month");
Scanner scanner = new Scanner(System.in);
String month = scanner.next();
if(month.equalsIgnoreCase("JANUARY")){
for(int i = 0; i<JANUARY.length;i++)
System.out.println(JANUARY[i]);
}
}
System.out.println("Enter the month");
Scanner scanner = new Scanner(System.in);
String month = scanner.next();
System.out.println("Enter the year");
int year = scanner.nextInt();
String[] months = {"january","febrary","march","april","may","june","july","aguest","septemper","october","november","december"};
for(int i = 0; i<months.length;i++){
if(month.equals(months[i])){
switch(i){
case 0:
System.out.println("no of days 31");
break;
case 1:
System.out.println("no of days 29");
break;
case 2:
System.out.println("no of days 31");
break;
case 3:
System.out.println("no of days 30");
break;
case 4:
System.out.println("no of days 31");
break;
case 5:
System.out.println("no of days 30");
break;
case 6:
System.out.println("no of days 31");
break;
case 7:
System.out.println("no of days 31");
break;
case 8:
System.out.println("no of days 30");
break;
case 9:
System.out.println("no of days 31");
break;
case 10:
System.out.println("no of days 30");
break;
case 11:
System.out.println("no of days 31");
break;
}
}
}
}
public static void listOfHolidays(){
String[] JANUARY = {"New Year","Pongal","Republicday"};
String[] FEBRARY = {"No Holiday in this month"};
String[] MARCH = {"No Holiday in this month"};
String[] APRIL = {"No Holiday in this month"};
String[] MAY = {"LaboursDay"};
String[] JUNE = {"No Holiday in this month"};
String[] JULY = {"No Holiday in this month"};
String[] AUGEST = {"Independents days"};
String[] SEPDEMBER = {"Diwali"};
String[] OCTOBER = {"No Holiday in this month"};
String[] NOVEMBER = {"Ramjan"};
String[] DECEMBER = {"Christmas"};
System.out.println("enter the month");
Scanner scanner = new Scanner(System.in);
String month = scanner.next();
if(month.equalsIgnoreCase("JANUARY")){
for(int i = 0; i<JANUARY.length;i++)
System.out.println(JANUARY[i]);
}
}
No comments:
Post a Comment