Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // DEVELOPED BY ZAID SAYAGE AND KYLE ORTZOW v.1.0.0
- import java.util.Scanner;
- public class P1G
- {
- public static void main(String[] args)
- {
- Scanner monthScanner = new Scanner(System.in);
- Scanner dayScanner = new Scanner(System.in);
- Scanner yearScanner = new Scanner(System.in);
- System.out.print("Enter month: ");
- int month = monthScanner.nextInt();
- if (month > 12)
- {
- System.out.println("ERROR Invalid month.");
- System.exit(1);
- }
- System.out.print("Enter day: ");
- int day = dayScanner.nextInt();
- if (day > 31)
- {
- System.out.println("ERROR Invalid day.");
- System.exit(1);
- }
- System.out.print("Enter Year: ");
- int year = dayScanner.nextInt();
- if (year == 2019)
- {
- int untilMonth = (5 - month) + 12;
- int untilDay = 29 - day;
- if (month % 2 == 0)
- {
- double evenMonth = (untilMonth * 30.436875 + untilDay);
- double roundMonth = Math.ceil(evenMonth);
- System.out.println("You will graduate in: " + roundMonth + " days.");
- }
- else
- {
- double oddMonth = (untilMonth * 30.436875 + untilDay);
- double roundOddMonth = Math.round(oddMonth);
- System.out.println("You will graduate in: " + roundOddMonth + " days.");
- }
- }
- if (year == 2020)
- {
- int untilMonth2020 = 5 - month;
- int untilDay2020 = 29 - day;
- if (month % 2 == 0)
- {
- double evenMonth2020 = (untilMonth2020 * 30.436875 + untilDay2020) - 1;
- double roundMonth2020 = Math.ceil(evenMonth2020);
- System.out.print("You will graduate in: " + roundMonth2020 + " days.");
- }
- else if (month == 2) {
- double evenMonth2020 = (untilMonth2020 * 30.436875 + untilDay2020) - 3;
- double roundMonth2020 = Math.ceil(evenMonth2020);
- System.out.print("You will graduate in: " + roundMonth2020 + " days.");
- }
- else
- {
- double oddMonth2020 = (untilMonth2020 * 30.436875 + untilDay2020);
- double roundOddMonth2020 = Math.round(oddMonth2020);
- System.out.println(roundOddMonth2020);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement