/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.calebfontenot.mp2_calebfontenot;

import java.util.Scanner;

/**
 *
 * @author caleb
 */
public class DayOfTheWeek {
    public static void main(String[] args) {
        // Create scanner
        Scanner input = new Scanner(System.in);
        // Define variables
        int dayOfTheWeek,
            dayOfTheMonth,
            century,
            yearOfTheCentury,
            month,
            year;
        String weekDay = "nullDay";
        
        // Prompt for input
        System.out.print("Enter year: (e.g., 2022): ");
        year = input.nextInt();
        System.out.print("Enter month: 1-12: ");
        month = input.nextInt();
        System.out.print("Enter day of the month: 1-31: ");
        dayOfTheMonth = input.nextInt();
        
        
        // Calculate
        century = (year / 100); //We are in the 21st century
        yearOfTheCentury = year % 100;
        
        dayOfTheWeek = ((dayOfTheMonth + ((26 * (month + 1)) / 10) + yearOfTheCentury + (yearOfTheCentury / 4) + (century / 4) + (5 * century)) % 7);
        System.out.println(dayOfTheWeek);
        
        // Switch moment
        switch (dayOfTheWeek) {
            case 0:
                weekDay = "Saturday";
            break;
            case 1:
                weekDay = "Sunday";
            break;
            case 2:
                weekDay = "Monday";
            break;
            case 3:
                weekDay = "Tuesday";
            break;
            case 4:
                weekDay = "Wednesday";
            break;
            case 5:
                weekDay = "Thursday";
            break;
            case 6:
                weekDay = "Friday";
            break;
        }
        
        
        // Output
        System.out.println("Day of the week is " + weekDay);
    }
}
