I am having trouble fixing this error in my program Write a

I am having trouble fixing this error in my program.

Write a java program that asks the user to enter a month and then prints the number of days in the month. For February, print 28 or 29 days
-------------------------------------------
import java.util.Scanner;
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
System.out.println(\"Enter a numeric month: \");
int month = scnr.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(days + \" days\");
}
}
I am having trouble fixing this error in my program.

Write a java program that asks the user to enter a month and then prints the number of days in the month. For February, print 28 or 29 days
-------------------------------------------
import java.util.Scanner;
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
System.out.println(\"Enter a numeric month: \");
int month = scnr.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(days + \" days\");
}
}

Solution

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package chegg;

import java.util.Scanner;


public class MonthDays {
  
public static void main(String[] args)
{
Scanner scnr = new Scanner(System.in);
System.out.println(\"Enter a numeric month: \");
int month = scnr.nextInt();
String days = \"\";
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 or 29\";
}
  
System.out.println(days + \" days\");
}
}

 I am having trouble fixing this error in my program. Write a java program that asks the user to enter a month and then prints the number of days in the month.
 I am having trouble fixing this error in my program. Write a java program that asks the user to enter a month and then prints the number of days in the month.

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site