Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Test plan for import java.util.Scanner; public class Exercise 0 3 _ 1 1 { public static void main ( String [ ] args ) {
Test plan for import java.util.Scanner;
public class Exercise
public static void mainString args
Declare variables
String month;
int days;
Scanner snew ScannerSystemin;
Read the month number from user
System.out.printEnter a month in the year eg for Jan: ;
int monthnumbersnextInt;
Read the year from user
System.out.printEnter a year: ;
int yearsnextInt;
Check the month number and assign month name and
number days
ifmonthnumber
month"January";
days;
else ifmonthnumber
month"February";
Check the leap year conditions
ifyear && year
days;
else ifyear && year
days;
else
days;
else ifmonthnumber
month"March";
days;
else ifmonthnumber
month"April";
days;
else ifmonthnumber
month"May";
days;
else ifmonthnumber
month"June";
days;
else ifmonthnumber
month"July";
days;
else ifmonthnumber
month"August";
days;
else ifmonthnumber
month"September";
days;
else ifmonthnumber
month"October";
days;
else ifmonthnumber
month"November";
days;
else ifmonthnumber
month"December";
days;
Print the output
System.out.printlnmonthyear has days days";
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started