Question
Design and implement the class Day that implements the day of the week in a program. The class Dayshould store the day, such as Sun
Design and implement the class Day that implements the day of the week in a program. The class Dayshould store the day, such as Sun for Sunday. The program should be able to perform the following operations on an object of type Day
Set the day-setDay()- a void method that takes the day as a parameter
Print the day-printDay()- a void method that prints the day and has no parameters
Return the day giveDay()-returns day which takes no parameters
Return the next day-giveNextDay()- returns next day which takes no parameters
Return the previous day-givePreviousDay()-returns previous day which takes no parameters
Write a program call it HW4.java to test various operations on the class Day
Follow coding standards carefully.
Remember to comment
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