Ask your own question, for FREE!
Computer Science 8 Online
OpenStudy (anonymous):

(days in a month) Design and implement an application that reads two integers representing the month and year from the user and that outputs the number of days in that month. use integer constants to repesent the 12 months.

OpenStudy (espex):

What language?

OpenStudy (anonymous):

input month, year if month in [Apr Jun Sep Nov] return 30 if month == Feb If (year mod 4) == 0 and (year mod 100) <> 0 or (year mod 400) == 0 return 29 else return 28 return 31

OpenStudy (anonymous):

in java

OpenStudy (espex):

Several ways you could do it so it depends on how much you already know about java. Given the level of the question I will assume it is a console app and not a gui. See if this is helpful in getting started. Your main function could be something like: // Create an instance of the input stream Sacnner in = new Scanner(System.in); int month, year; // Create two integer variables // Ask the user for input System.out.println("Please enter a number between 1 and 12"); month = in.nextInt(); // record the input into the variable System.out.println("Please enter a year"); year = in.nextInt(); /* Do some error checking to be certain of legit values */ /* Put in some evaluations to determine the number entered */ days = /* some calc */ /* Print the results */ System.out.println("The number of days in the "+ month + " is " + days +".");

OpenStudy (anonymous):

beginning level, this is my class exercise. thanks a lot.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!