SHARE
TWEET

Untitled

a guest Aug 22nd, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // DEVELOPED BY ZAID SAYAGE AND KYLE ORTZOW v.1.0.0
  2. import java.util.Scanner;
  3. public class P1G
  4. {
  5.     public static void main(String[] args)
  6.     {
  7.         Scanner monthScanner = new Scanner(System.in);
  8.         Scanner dayScanner = new Scanner(System.in);
  9.         Scanner yearScanner = new Scanner(System.in);
  10.         System.out.print("Enter month: ");
  11.         int month = monthScanner.nextInt();
  12.         if (month > 12)
  13.         {
  14.             System.out.println("ERROR Invalid month.");
  15.             System.exit(1);
  16.         }
  17.         System.out.print("Enter day: ");
  18.         int day = dayScanner.nextInt();
  19.         if (day > 31)
  20.         {
  21.             System.out.println("ERROR Invalid day.");
  22.             System.exit(1);
  23.         }
  24.         System.out.print("Enter Year: ");
  25.         int year = dayScanner.nextInt();
  26.         if (year == 2019)
  27.         {
  28.             int untilMonth = (5 - month) + 12;
  29.             int untilDay = 29 - day;
  30.             if (month % 2 == 0)
  31.             {
  32.                 double evenMonth = (untilMonth * 30.436875 + untilDay);
  33.                 double roundMonth = Math.ceil(evenMonth);
  34.                 System.out.println("You will graduate in: " + roundMonth + " days.");
  35.             }
  36.             else
  37.             {
  38.                 double oddMonth = (untilMonth * 30.436875 + untilDay);
  39.                 double roundOddMonth = Math.round(oddMonth);
  40.                 System.out.println("You will graduate in: " + roundOddMonth + " days.");
  41.             }
  42.         }
  43.            if (year == 2020)
  44.            {
  45.                int untilMonth2020 = 5 - month;
  46.                int untilDay2020 = 29 - day;
  47.                if (month % 2 == 0)
  48.                {
  49.                    double evenMonth2020 = (untilMonth2020 * 30.436875 + untilDay2020) - 1;
  50.                    double roundMonth2020 = Math.ceil(evenMonth2020);
  51.                    System.out.print("You will graduate in: " + roundMonth2020 + " days.");
  52.                }
  53.                else if (month == 2) {
  54.                    double evenMonth2020 = (untilMonth2020 * 30.436875 + untilDay2020) - 3;
  55.                    double roundMonth2020 = Math.ceil(evenMonth2020);
  56.                    System.out.print("You will graduate in: " + roundMonth2020 + " days.");
  57.                }
  58.                else
  59.                {
  60.                    double oddMonth2020 = (untilMonth2020 * 30.436875 + untilDay2020);
  61.                    double roundOddMonth2020 = Math.round(oddMonth2020);
  62.                    System.out.println(roundOddMonth2020);
  63.                }
  64.            }
  65.     }
  66. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top