Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Day08A {
- public static void main(String[] args) {
- Scanner uInput = new Scanner(System.in);
- int totalMonthday;
- String monthName;
- System.out.print("Enter month: ");
- monthName = uInput.nextLine();
- switch (monthName.toLowerCase()) {
- case "january":
- case "march":
- case "may":
- case "july":
- case "august":
- case "october":
- case "december":
- totalMonthday = 31;
- break;
- case "april":
- case "june":
- case "september":
- case "november":
- totalMonthday = 30;
- break;
- case "february":
- totalMonthday = 28;
- break;
- default:
- System.out.println("Not a valid month. Please try again");
- break;
- }
- System.out.println(monthName + " have " + totalMonthday + " days");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment