Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
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