Design and implement the class Day that implements the day of the week in a program The class day should store the day, such as Sun for Sunday.

The program should be able to perform the following operations on an object of type Day:

A. Set the day
B. Print the day
C. Return the day
D. Return the next day.
C. Return the previous day

import java.util.*;

public class TestWeekDays
   // define the keyboard scanner 
   Scanner readinput = new Scanner(System.in);

   public static void main(String[] args)
      //declare string
      String storeday = " ";

   WeekDays testday = new WeekDays(); 
   //user input to enter the day
   System.out.print("Enter the day: ");
   //input the day- save it/store it
   String storeday = readinput.nextLine();
   //set/store your day
   //get the day
   System.out.println("The day is " + testday.getDays());
   //test printing 
   //get the previous day
   System.out.println("The previous day is " + testday.getPreDays());
   //get the next day
   System.out.println("The next day is " + testday.getNextDays());


Edited by __avd: Improved formatting.

5 Years
Discussion Span
Last Post by jwenting
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.