Member Avatar for love1969

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);

   //Test
   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
   testday.setDays(storeday);
   //get the day
   System.out.println("The day is " + testday.getDays());
   //test printing 
   testday.printDay();
   //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());

  }
}

you haven't mentioned your actaul problem is

please mention the actual problem for getting write answer

Read this first. Have fun with it ;-)

Enum to the rescue?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.