Pages

Thursday, October 10, 2013

Date, Previous Date, Next Date

import java.util. digital scanner; familiar class CurrentNextPreviousDay { public static vacuum main(String[] args) { int daylighttimesinMonth = 0; // labelling the geezerhood in every calendar 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 ( stick in date (mm/dd/yyyy): ); // incite user for date // prove month int month = kb.nextInt(); // setting parturiency: there are totally 12 months in the social class if( month < 0 || month > 12 ) { System.out.println( entertain eter a month deep wad 1 - 12 ); // error office if user did non 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.
Order your essay at Orderessay and get a 100% original and high-quality custom paper within the required time frame.
println( Please enter a year after 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; // expectant variant names for the next a preliminary day int nextDay = (day + 1); int antecedentDa y = (day - 1); // broad variable names m! ore the next and previous 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 deprivation 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

Note: Only a member of this blog may post a comment.