Question: code and screenshot of output. Task #1 Character and String Class Methods 1. Copy the files Time.java and TimeDemo.java 2. In the Time.java file, add

code and screenshot of output.
Task #1 Character and String Class Methods 1. Copy the files Time.java and TimeDemo.java 2. In the Time.java file, add conditions to the decision structure which validates the data. Conditions are needed that will a) Check the length of the string b) Check the position of the colon c) Check that all other characters are digits 3. Add lines that will separate the string into two substrings containing hours and minutes. Convert these substrings to integers and save them into the instance variables. 4. In the TimeDemo class, add a condition to the loop that converts the user's answer to a capital letter prior to checking it. 5. Compile, debug, and run. Test out your program using the following valid input: 00:00, 12:00, 04:05, 10:15, 23:59, 00:35, and the following invalid input: 7:56, 15:78, 08:60, 24:00, 3e:33, 1:111. s below
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
