Question: Create a public enum Weekday with constants for MONDAY, TUESDAY.... until SUNDAY. The enum should have an instance method boolean isWeekday()and an instance method boolean

 Create a public enum Weekday with constants for MONDAY, TUESDAY.... until

Create a public enum Weekday with constants for MONDAY, TUESDAY.... until SUNDAY. The enum should have an instance method boolean isWeekday()and an instance method boolean is Holiday The isHoliday() method should return the opposite of isWeekdayo Write a program which demonstrates how this enum could be used, which has a method testDay which takes a Weekday as the argument and prints a message depending on whether the Weekday is a holiday or not. If holiday print "Stay home and play with your cat." If weekday, print "Go to work." In the main method loop over all values in the Weekday enum and sends them as argument to the method

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!