Problem

Writing a Modular Program in Java In this lab, you add the input and output statements...

Writing a Modular Program in Java

In this lab, you add the input and output statements to a partially completed Java program. When completed, the user should be able to enter a year and then click the OK button, enter a month and then click the OK button, and enter a day and then click the OK button to determine if the date is valid. Valid years are those that are greater than 0, valid months include the values 1 through 12 and valid days include the values 1 through 31.

1. Open the source code file named BadDate java using Notepad or the text editor of your choice.

2. Notice that variables have been declared for you.

3. Write the simulated housekeeping() method that contains input statements to retrieve a year, a month, and a day from the user.

4. Add statements to the simulated housekeeping() method that convert the String representation of the year, month, and day to ints.

5. Include the output statements in the simulated endof iob() method. The format of the output is as follows:

month/day/year is a valid date.

Or

month/day/year is an invalid date.

6. Save this source code file in a directory of your choice, and then make that directory your working directory.

7. Compile the source code file BadDate java.

8. Execute the program entering the following date: month = 5, day = 32, year =2014. Record the output of this program. _____________________________________________________________________________________

9. Execute the program entering the following date: month = 9, day = 21, year = 2002. Record the output of this program. _____________________________________________________________________________________

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 3
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT