Write a method using the following header that determines whether the day of the month is a working day and will retun "Working Day" and "Non-working Day" accordingly. The method accepts two parameters: day of week for the 1" day of the month and day of the month (you can assume each month has exactly 30 days). If the given day of the month is not a valid number, the method should return "Incorrect Day of Month". If the given initDayOfWeek is not a valid number, the method should return "Incorrect Initial Day of Week" If both numbers are incorrect, only return "Incorrect Initial Day of Week". public static String isWorkingDay (int initDayOrWeek, int dayNum) (To make the day of week easier to be represented in the program, we use int number 0 to represent Sunday, I to represent Monday, 2 to represent Tuesday .. and 6 to represent Saturday) Examples isWorkingDay (0, 1) returns "Non-working Day" . (As 1" day of the month is Sunday) isWorkingDay (1, 2) returns "Working Day" . (As 1ª day of the month is Monday, and 2nd day of the Month will be Tuesday) isWorkingDay (7, 2) returns "Incorrect Initial Day of Week" . (As 7 is not a valid day of week) isWorkingDay (7, 50) returns "Incorrect Day of Month" . (As 50 is not a valid day of month)
Write a method using the following header that determines whether the day of the month is a working day and will retun "Working Day" and "Non-working Day" accordingly. The method accepts two parameters: day of week for the 1" day of the month and day of the month (you can assume each month has exactly 30 days). If the given day of the month is not a valid number, the method should return "Incorrect Day of Month". If the given initDayOfWeek is not a valid number, the method should return "Incorrect Initial Day of Week" If both numbers are incorrect, only return "Incorrect Initial Day of Week". public static String isWorkingDay (int initDayOrWeek, int dayNum) (To make the day of week easier to be represented in the program, we use int number 0 to represent Sunday, I to represent Monday, 2 to represent Tuesday .. and 6 to represent Saturday) Examples isWorkingDay (0, 1) returns "Non-working Day" . (As 1" day of the month is Sunday) isWorkingDay (1, 2) returns "Working Day" . (As 1ª day of the month is Monday, and 2nd day of the Month will be Tuesday) isWorkingDay (7, 2) returns "Incorrect Initial Day of Week" . (As 7 is not a valid day of week) isWorkingDay (7, 50) returns "Incorrect Day of Month" . (As 50 is not a valid day of month)
Chapter12: Exception Handling
Section: Chapter Questions
Problem 16RQ
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 2 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT