Question: Write a class that will test dates and times inputted by the user and determine whether or not it is valid. This will focus

Write a class that will test dates and times inputted by the user and determine whether or not it is valid. This will focus  on the usages of methods to organize code. Requirements: Functionality. (80pts) NoSyntax Errors. (80pts*) *Code that cannot be compiled due to syntax errors

Write a class that will test dates and times inputted by the user and determine whether or not it is valid. This will focus on the usages of methods to organize code. Requirements: Functionality. (80pts) No Syntax Errors. (80pts*) *Code that cannot be compiled due to syntax errors is nonfunctional code and will receive no points for this entire section. Set up the Project (10pts) First download the driver and include it in Do not alter the code found in the driver. Use this to run your project your project. Create a class and name it exactly DateAndTimeTester . Do not include the "main method" All must apply for full credit. Create the following methods in DateAndTimeTester run: This method returns nothing and takes no parameters. This is called by the driver and should handle all of the input from the Scanner and dialog for the user. (5pts) isValid: returns true or false if a given String has the correct date and time. The String parameter should be formatted "MM/DD hh:mm" This method should call the methodsindo is ValidDate and is ValidTime to determine this. (5pts) Go to Settings to act is ValidDate: returns true or false if a given String has a correct date. The String parameter should be formatted "MM/DD" and should use the method getMonth and getDay to determine the date's validity. Also assume February only has 28 days. (10pts) is ValidTime: returns true or false if a given String has a correct time. The String parameter should be formatted "hh:mm" and should use the getHour and getMinute to determine the time's validity. Valid times are from 1 to 12. (10pts) getMonth: returns an integer value representing the month for a given String. The String parameter is expected to be formatted "MM/DD". (10pts) getDay: returns an integer value representing the day for a given String. The String parameter is expected to be formatted "MM/DD". (10pts) getHour: returns an integer value representing the hour for a given String. The String parameter is expected to be formatted "hh:mm". (10pts) getMinute: returns an integer value representing the minute for a given String. The String parameter is expected to be formatted "hh:mm". (10pts) HINT: Notice how each part of data is separated given its format. Notice how first the Date and the Time are separated, then notice how the Month and the Day are separated for a Date and notice how the Hour and Minute are separated for a Time. Noticing this will help extract the data Date and Time, then further extract (or get) the Month and Day from the Date and the Hour and Minute from the Time. Coding Style. (10pts) Code functionality organized within multiple methods other than the main method, and methods organized within multiple classes where appropriate. (5pts) o Readable Code. (5pts) Activate Go to Set Meaningful identifiers for data and methods. Proper indentation that clearly identifies statements within the body of a class, a method, a branching statement, a loop statement, etc. All the above must apply for full credit. Comments. (10pts) Your name in the file. (5pts) At least 5 meaningful comments in addition to your name. These must describe the function of the code it is near. (5pts) For reference MM/DD hh:mm is Month/Date Hour : Minute respectively. For every part, it is valid to enter one or both digits, so "01/01 01:01 is valid and 1/1 1:01 is also valid. Example Dialog: Enter a date and time (MM/DD hh:mm) and I will determine if it is valid 06/22 3:00 The date and time is valid! Would you like to exit? Type "quit" to exit or press [ENTER] to continue Enter a date and time (MM/DD hh:mm) and I will determine if it is valid 9/31 12:00 The date and time is not valid Would you like to exit? Type "quit" to exit or press [ENTER] to continue Enter a date and time (MM/DD hh:mm) and I will determine if it is valid 12/08 13:00 The date and time is not valid Would you like to exit? Type "quit" to exit or press [ENTER] to continue quit Good bye public class DateAndTimeDriver { public static void main(String[] args) { DateAndTimeTester dtTester = new DateAndTimeTester(); dtTester.run(); } }

Step by Step Solution

3.56 Rating (160 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Answer Below is the implementation of the DateAndTimeTester class according to the given requirement... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!