I'm working on a program that calculates the day of the week for dates in history or the future. I have the calculation part correctly but there are 4 errors left that I do not know how to fix. Any help will be greatly appreciated!
Thanks
import java.util.Scanner;
public class DayOfWeek
{
public static int Month(String Month)
{
int Monthnum;
if(Month.equals("January") || Month.equals("October"))
{
Monthnum = 3;
}
if(Month.equals("February") || Month.equals("March") || Month.equals("November"))
{
Monthnum = 6;
}
if(Month.equals("April") || Month.equals("July"))
{
Monthnum = 2;
}
if(Month.equals("May"))
{
Monthnum = 4;
}
if(Month.equals("June"))
{
Monthnum = 0;
}
if(Month.equals("August"))
{
Monthnum = 5;
}
if(Month.equals("September") || Month.equals("December"))
{
Monthnum = 1;
}
return Monthnum;
}
public static int Century (int Century)
{
int Centurynum;
if(Century > 1752 && Century < 1799)
{
Centurynum = 2;
}
if(Century > 1800 && Century < 1899)
{
Centurynum = 0;
}
if(Century > 1900 && Century < 1999)
{
Centurynum = 5;
}
if(Century > 2000 && Century < 2099)
{
Centurynum = 4;
}
if(Century > 2100 && Century < 2200)
{
Centurynum = 2;
}
return Centurynum;
}
public static int DOWnum (int DOWnum)
{
String DOW;
if(DOWnum== 1)
{
DOW = ("Sunday");
}
if(DOWnum== 2)
{
DOW = ("Monday");
}
if(DOWnum== 3)
{
DOW = ("Tuesday");
}
if(DOWnum== 4)
{
DOW = ("Wednesday");
}
if(DOWnum== 5)
{
DOW = ("Thursday");
}
if(DOWnum== 6)
{
DOW = ("Friday");
}
if(DOWnum = 0)
{
DOW = ("Saturday");
}
return DOW;
}
public static void main (String [] args)
{
Scanner input=new Scanner(System.in);
System.out.println("This Program will find what day of the week any date was prier to September 14th, 1752");
System.out.println(" ");
int Century, Centurynum, Monthnum, date, Century1, dividedfour, total, DOWnum;
System.out.print("Please enter the month(Full name ex: January): ");
String Month = input.nextLine();
System.out.print("Please enter the day of the month: ");
date = input.nextInt();
System.out.print("Please enter the year(ex: 1900): ");
Century = input.nextInt();
Monthnum = Month(Month);
Centurynum = Century(Century);
Century1 = (Century%1000)%100;
dividedfour = Math.floor(Century1/4);
total = Century1+dividedfour+Centurynum+Monthnum+date;
DOWnum = total%7;
String DOW = DOWnum(DOWnum);
System.out.print(DOW);
}
}