Task #1 Character and String Class Methods
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.
Task #2 StringTokenizer and StringBuilder classes
1. Copy the file secret.txt(code listing 10.3) from www.aw.com/cssupportor as
directed by your instructor. This file is only one line long. It contains 2
sentences.
2. Write a main method that will read the file secret.txt,separate it into word
tokens.
3. You should process the tokens by taking the first letter of every fifth word,
starting with the first word in the file. These letters should converted to capitals,
then be appended to a StringBuilder object to form a word which will be printed
to the console to display the secret message.
Choose an academic level, add pages, and the paper type you want.
To reduce the cost of our essay writing services, select the lengthier deadline.
We can't believe we just said that to you.
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more
Recent Comments