import java.util. digital scanner; human beings class CurrentNextPreviousDay { public static vacuum main(String[] args) { int long timeinMonth = 0; // labelling the sidereal categorys in any calendar month separate than febuary int sidereal daysinLastMonth = 0; int daysinNextMonth = 0; int DaysInFebuary = 0; // Labelling the days in febuary Scanner kb = new Scanner (System.in); System.out.print ( take part date (mm/dd/yyyy): ); // incite user for date // hear month int month = kb.nextInt(); // setting parturiency: there are and 12 months in the year if( month < 0 || month > 12 ) { System.out.println( revel eter a month deep spate 1 - 12 ); // error message if user did not follow parapets System.exit(0); } // read day int day = kb.nextInt(); // restriction: there are no negative days in a month if (day < 0) { System.out.println( Please enter a positive number ); // error gist if user did not follow restrictions System.exit(0); } // read year int year = kb.nextInt(); // restriction: cant be less than year 1582 in a Gregorian calendar if ( year < 1582 ) { System.out.
println( Please enter a year aft(prenominal) 1582 ); // error essence if user did not follow restrictions System.exit(0); } // Finding whether Febuary is 28 or 29 Boolean isLeapYear = (year % 4 == 0) && (year % 100 != 0) || (year % 400 == 0); DaysInFebuary = isLeapYear ? 29 : 28; // prominent variant names for the next a preliminary day int nextDay = (day + 1);! int antecedentDay = (day - 1); // bounteous variable names more the next and prior month int nextMonth = (month + 1); int previousMonth = (month - 1); // giving variable months january (firstMonth) and decemeber (lastMonth) int firstMonth = 1; int lastMonth = 12; // giving variable for the number of days in the months january (firstMonth) and decemeber (lastMonth) int daysInDecember = 31; int...If you requisite to start a full essay, order it on our website: BestEssayCheap.com
If you want to get a full essay, visit our page: cheap essay
No comments:
Post a Comment