C Search Textbook Solutions Che X + staticb/ui/ev/indexhtml?SBN 97813372746098 snapshotid=1498772&cid=6605073098takeld-18327301-52.413d-bd13-38c172177567& Writing a Modular Program in Java Writing a Modular Program in Java BadDate.java /* Program Name: BadDate.java Function: This program determines If a date entered by the user is valid. Input: Interactive Output: Valid date is printed or user is alerted that an invalid date was entered. Summary 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, a month, and a day 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 through 31. 7 import java.util.Scanner; public class BadDate public static void main(String args[]) Declare variables Instructions 1. Notice that variables have been declared for you. 2. Write the simulated housekeeping method that contains input statements to retrieve a year a month, and a day from the user String year String: String monthstring; String dayString: int year: int month; Int day: boolean validate - true; final int MIN_YEAR - O, MIN MONTH - 1.MAX_MONTH - 12, MIN_DAY - 1. MAX DAY - 31: 3. Add statements to the simulated method that convert ng representation of the year month, and day to // This is the work of the housekeeping method // Get the year, then the month, then the day Scanner Input - new Scanner(System.in); 1 variable - input.nextLine: Convert Strings to Inteers 4. Include the output statements in the simulated method. The format of the output is as follows This is the work of the detail Loop() method 10 WP tation BadDate.java Writing a Modular Program in Java Writing a Modular Program in Java VELG 4. Include the output statements in the simulated endofob() method. The format of the output is as follows: I! This is the work of the detailLoop() method 1 Check to be sure date is valid 11 yearMIN_YEAR) / Invalid year validate - false; else if ( month (MIN_MONTH 11 month > MAX_MONTH) !! Invalid nonth/day/year is a valid date validate - false; else if (day HIN_DAY 11 day > MAX_DAY ) validate - false; / Invalid day nonth/day/year analid date 5. Execute the program entering the following date: month - 5. day - 32 year 2014 This is the work of the end ob() method 1 Test to see if date is valid and output date and whether it is Lid or not IF( validate - true) 11 output statement Observe the output of this program. 6. Execute the program entering the following date: 1 Output statement Honth day - 21 year 2002 ) end of main() method Observe the output of this program. 1/ end of Badbate class Grading When you have completed your program, click the Submit button to record your score. C Search Textbook Solutions Che X + staticb/ui/ev/indexhtml?SBN 97813372746098 snapshotid=1498772&cid=6605073098takeld-18327301-52.413d-bd13-38c172177567& Writing a Modular Program in Java Writing a Modular Program in Java BadDate.java /* Program Name: BadDate.java Function: This program determines If a date entered by the user is valid. Input: Interactive Output: Valid date is printed or user is alerted that an invalid date was entered. Summary 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, a month, and a day 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 through 31. 7 import java.util.Scanner; public class BadDate public static void main(String args[]) Declare variables Instructions 1. Notice that variables have been declared for you. 2. Write the simulated housekeeping method that contains input statements to retrieve a year a month, and a day from the user String year String: String monthstring; String dayString: int year: int month; Int day: boolean validate - true; final int MIN_YEAR - O, MIN MONTH - 1.MAX_MONTH - 12, MIN_DAY - 1. MAX DAY - 31: 3. Add statements to the simulated method that convert ng representation of the year month, and day to // This is the work of the housekeeping method // Get the year, then the month, then the day Scanner Input - new Scanner(System.in); 1 variable - input.nextLine: Convert Strings to Inteers 4. Include the output statements in the simulated method. The format of the output is as follows This is the work of the detail Loop() method 10 WP tation BadDate.java Writing a Modular Program in Java Writing a Modular Program in Java VELG 4. Include the output statements in the simulated endofob() method. The format of the output is as follows: I! This is the work of the detailLoop() method 1 Check to be sure date is valid 11 yearMIN_YEAR) / Invalid year validate - false; else if ( month (MIN_MONTH 11 month > MAX_MONTH) !! Invalid nonth/day/year is a valid date validate - false; else if (day HIN_DAY 11 day > MAX_DAY ) validate - false; / Invalid day nonth/day/year analid date 5. Execute the program entering the following date: month - 5. day - 32 year 2014 This is the work of the end ob() method 1 Test to see if date is valid and output date and whether it is Lid or not IF( validate - true) 11 output statement Observe the output of this program. 6. Execute the program entering the following date: 1 Output statement Honth day - 21 year 2002 ) end of main() method Observe the output of this program. 1/ end of Badbate class Grading When you have completed your program, click the Submit button to record your score