I dont quite understand the program assignment Please help R

I don\'t quite understand the program assignment. Please help

Recently we\'ve been using Boolean, if else, and switch statements but I\'m confused on how to approach this specific assignment. So far this is what I have...

import java.util.Scanner;
public class Lab3d {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
System.out.println(\"Enter a numeric month: \");
Background Reading Horstmann, Java For Everyone,Chapter 3. ZyBook, Section 3 Assignment Lab3d Write a Java program that asks the user to enter a month (1 for January, 2 for February, and so on) and then prints the nu mber of days in the month. For February, print 28 or 29 days. Requirements: The name of the Java class is Lab3d Your \"dentification string\" should be the first comment of the main method. // The prompt should be on its own line with the following text fie. use System.out.printlnO: Enter a numeric month: Print number of days in the given month. For February, print 28 or 29 days . Program 3 , [ Name ] , [masc1d ] · Lab Suomiasion 3.19.1: Lab 3d Due 11-Oct-16 13 pts File: Lab3d.java

Solution

MonthDays.java

import java.util.Scanner;


public class MonthDays {

  
   public static void main(String[] args) {
       Scanner scan = new Scanner(System.in);
       System.out.println(\"Enter a numeric month: \");
       int month = scan.nextInt();
       int days = 0;
       if(month ==1 || month == 3 || month ==5 || month == 7 || month ==8 || month == 10 || month == 12){
           days = 31;
       }
       else if(month == 4 || month == 6 || month == 9 || month ==11){
           days = 30;
       }
       else if(month == 2){
           days = 28;
       }
       System.out.println(\"The number of days in month \"+month+\" is \"+days);
      

   }

}

Output:

Enter a numeric month:
5
The number of days in month 5 is 31

I don\'t quite understand the program assignment. Please help Recently we\'ve been using Boolean, if else, and switch statements but I\'m confused on how to app

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site