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)

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Write a method using the following header that determines whether the day of the month is a
working day and will return "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 initDayOfWeek, int dayNum)
(To make the day of week easier to be represented in the program, we use int number 0 to
represent Sunday, 1 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)
Transcribed Image Text:Write a method using the following header that determines whether the day of the month is a working day and will return "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 initDayOfWeek, int dayNum) (To make the day of week easier to be represented in the program, we use int number 0 to represent Sunday, 1 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)
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Returning value from Function
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.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education