Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ProgramingBasicsOverview;
- import java.util.Scanner;
- public class P05MonthPrinter {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int number = Integer.parseInt(scanner.nextLine());
- String month = "";
- switch (number) {
- case 1 -> month = "January";
- case 2 -> month = "February";
- case 3 -> month = "March";
- case 4 -> month = "April";
- case 5 -> month = "May";
- case 6 -> month = "June";
- case 7 -> month = "July";
- case 8 -> month = "August";
- case 9 -> month = "September";
- case 10 -> month = "October";
- case 11 -> month = "November";
- case 12 -> month = "December";
- default -> month = "Error!";
- }
- System.out.println(month);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement