a program using Java NetBeans (Console application). With the following enum class: public enum Day { SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY } Create a second class called enumDayMood with a void method call telDayMood (). This method contain a switch case as follows: switch (day) { case MONDAY: JOptionPane.showMessageDialog (frame, "Mondays are bad."); break; case FRIDAY: JOptionPane.showMessageDialog (frame, "Fridays are better.");
Design a
enum class:
public enum Day {
SUNDAY, MONDAY, TUESDAY, WEDNESDAY,
THURSDAY, FRIDAY, SATURDAY
}
Create a second class called enumDayMood with a void method call telDayMood ().
This method contain a switch case as follows:
switch (day) {
case MONDAY:
JOptionPane.showMessageDialog (frame, "Mondays are bad.");
break;
case FRIDAY:
JOptionPane.showMessageDialog (frame, "Fridays are better.");
break;
case SATURDAY: case SUNDAY:
JOptionPane.showMessageDialog (frame, "Weekends are best.");
break;
default:
JOptionPane.showMessageDialog (frame, “Midweek days are so-so.");
break;
}
Create a method that will ask the user to enter a day of a week and the program should tell the
mood of the day. If the user enter a wrong value the program should exit with 0.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps