A Class is given to you. Implement the following things in this class. 1. Define an instance variable called "dayName". This field should be defined as a string. It should hold one of the following values "SUN, MON, TUE, WED, THU, FRI, SAT". (Note that the values can be in upper or lower case) 2. Add a accessor or getter method for this field. By convention the getter method should be written as getDayName(). This method should return the field dayName 3. Add a mutator or setter method for the field. By convention the setter method should be called setDayName(String dayName). Note that the input to this field could be one of the following: "SUN, MON, TUE, WED, THU, FRI, SAT, Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday". All these values are valid. In case the input is Sunday, the value should be accepted, But Stored as SUN. Similarly if the input is Friday, it should be accepted but stored as FRI. If input is not valid, assign NULL to field value.NOTE that the input can be lower or upper or mixed case, and all such values should be accepted. The value must be stored in capital letters only. 4. Add a public method : getNextDay(): This method should return the next day of the week. If the field value is sUN, then it should return MON. If the field value is THU, it should return FRI and so on 5. Add a public method : getPreviousDay(): This method should return the previous day of the week. If the field value is SsUN, then it should return SAT. If the field value is THU, it should return WED and so on 6. Add a public method : addToCurrentDay(int noOfDays): This method should add the given number of days to the dayName and return the day of the week of the resulting day. For example, if the fieldValue dayName is Sun and this method is called with input as 4, then the output should be Thu, as 4 days after Sunday is Thu. If the input is -4 output should be Wed as 4 days before Sunday is Wed.
A Class is given to you. Implement the following things in this class. 1. Define an instance variable called "dayName". This field should be defined as a string. It should hold one of the following values "SUN, MON, TUE, WED, THU, FRI, SAT". (Note that the values can be in upper or lower case) 2. Add a accessor or getter method for this field. By convention the getter method should be written as getDayName(). This method should return the field dayName 3. Add a mutator or setter method for the field. By convention the setter method should be called setDayName(String dayName). Note that the input to this field could be one of the following: "SUN, MON, TUE, WED, THU, FRI, SAT, Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday". All these values are valid. In case the input is Sunday, the value should be accepted, But Stored as SUN. Similarly if the input is Friday, it should be accepted but stored as FRI. If input is not valid, assign NULL to field value.NOTE that the input can be lower or upper or mixed case, and all such values should be accepted. The value must be stored in capital letters only. 4. Add a public method : getNextDay(): This method should return the next day of the week. If the field value is sUN, then it should return MON. If the field value is THU, it should return FRI and so on 5. Add a public method : getPreviousDay(): This method should return the previous day of the week. If the field value is SsUN, then it should return SAT. If the field value is THU, it should return WED and so on 6. Add a public method : addToCurrentDay(int noOfDays): This method should add the given number of days to the dayName and return the day of the week of the resulting day. For example, if the fieldValue dayName is Sun and this method is called with input as 4, then the output should be Thu, as 4 days after Sunday is Thu. If the input is -4 output should be Wed as 4 days before Sunday is Wed.
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
I need the answer as soon as possible
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 5 images
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY