Hi,
I'm writing a program and it saying their are two missing return statements .
can u help me to find the two missing return statements ?
:-|
import java.util.*;
import java.io.*;
public class DayOfWeek
{
static Scanner s = new Scanner(System.in);
static public class Day
{
private String day;
public Day()
{
day=" ";
}
public Day(String theDay)
{
setDay(theDay);
}
public void setDay(String theDay)
{
day = theDay;
}
public void printDay()
{
System.out.println(day);
}
public String getDay()
{
return day;
}
public String getNextDay()
{
if(day == "Saturday")
return ("Sunday");
else if(day == "Sunday")
return ("Monday");
else if(day == "Monday")
return ("Tuesday");
else if(day == "Tuesday")
return ("Wednesday");
else if(day == "Wednesday")
return ("Thursday");
else if(day == "Thursday")
return ("Friday");
else if(day == "Friday")
return ("Saturday");
}
public String getPreDay()
{
if(day == "Friday")
return ("Thursday");
else if(day == "Thursday")
return ("Wednesday");
else if(day == "Wednesday")
return ("Tuesday");
else if(day == "Tuesday")
return ("Monday");
else if(day == "Monday")
return ("Sunday");
else if(day == "Sunday")
return ("Saturday");
else if(day == "Saturday")
return ("Friday");
}
}
public static void main (String args[])
{
Day myDay = new Day("Monday");
Day tempDay = new Day("Sunday");
myDay.printDay();
System.out.println("The day previous "+ myDay +" is " + myDay.getPreDay());
System.out.println("The next day of "+ myDay +" is "+ myDay.getNextDay());
tempDay.printDay();
System.out.println("The day previous "+ tempDay +" is " + tempDay.getPreDay());
System.out.println("The next day of "+ tempDay +" is "+ tempDay.getNextDay());
}
}
Thanx,