Question: Write this code in pseudocode import java.util.Scanner; public class Exercise { public static void main ( String [ ] args ) { Scanner input =
Write this code in pseudocode
import java.util.Scanner;
public class Exercise
public static void mainString args
Scanner input new ScannerSystemin;
System.out.printEnter a month in the year eg for Jan: ;
int month input.nextInt;
System.out.printEnter a year: ;
int year input.nextInt;
input.close;
int days getDaysInMonthmonth year;
if days
String monthName getMonthNamemonth;
System.out.printlnmonthName year has days days.";
else
System.out.printlnInvalid month number. Please enter a number between and ;
public static int getDaysInMonthint month, int year
if month month
return ; Invalid month
switch month
case :
if year && year year
return ; Leap year
else
return ; Nonleap year
case : case : case : case :
return ; April, June, September, November
default:
return ; January, March, May, July, August, October, December
public static String getMonthNameint month
String monthNames
"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
;
return monthNamesmonth ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
