Question: IN JAVA: You must include comments in your code. You must use user - defined methods. You must use class definition methods discussed in class.
IN JAVA: You must include comments in your code.
You must use userdefined methods.
You must use class definition methods discussed in class.
You must have a DayType class file and a Driver class file.
Problem specification:
Design and implement a class DayType that implements the day of the week in a program. The class DayType should store the day of the week, Sun for Sunday, Mon for Monday, etc. The program should be able to perform the following operations on an object of type DayType:
Set the day
Print the day
Return the day
Return the next day
Return the previous day
Add the appropriate constructors default and overloaded constructors
Calculate and return the day by adding certain day to the current day. For example, if the current day is Monday, which has an index of and we add days the day returned is Friday. Similarly, if today is Tuesday and we add days, the day to be returned is Monday.
Hint: the above are descriptions of methods that the DayType object should implement.
Answer the following questions below:
#: List the private fields and their data types for the object described above.
#: Define the default and overloaded constructors for the object
#: List all the methods, their data types, and their parameters for the object described above
# In the Driver class, write java statements to declare an instance of the DayType object called day. Prompt the user to enter the day of the week to set the day object to Invoke the appropriate methods of the day object and print its value after each change has occurred. Call the method to calculate the day of the week based on a value entered by the user. Include the code created for the Driver.java file and a screenshot of the running program after testing.
PASTE IMPLEMENTED CODE, INPUT, AND OUTPUT HERE
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
