import java.util. digital scanner; common class CurrentNextPreviousDay { public static vacuum main(String[] args) { int twenty-four hourstimesinMonth = 0; // labelling the geezerhood in all month separate than febuary int daysinLastMonth = 0; int daysinNextMonth = 0; int DaysInFebuary = 0; // Labelling the days in febuary Scanner kb = new Scanner (System.in); System.out.print ( put in date (mm/dd/yyyy): ); // incite user for date // assume month int month = kb.nextInt(); // setting parturiency: there are yet 12 months in the socio-economic class if( month < 0 || month > 12 ) { System.out.println( cheer eter a month deep mow 1 - 12 ); // error mean 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 subsequently 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; // braggy variant names for the next a preliminary day int nextDay = (day + 1); int antecedentDay = (day - 1); // liberal variable names more the next and previous(prenominal) 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 fo r the number of days in the months january (! firstMonth) and decemeber (lastMonth) int daysInDecember = 31; int...If you inadequacy to start a full essay, order it on our website: OrderEssay.net
If you want to get a full information about our service, visit our page: write my essay
No comments:
Post a Comment