Posted: October 28th, 2022

1character and string class methods

  

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

Task #1Character 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.

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

Expert paper writers are just a few clicks away

Place an order in 3 easy steps. Takes less than 5 mins.

Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
$0.00
error: Content is protected !!
Open chat
1
Order through WhatsApp!
affordablepaperwritings.com
Hello!
You Can Now Place your Order through WhatsApp
 

 

Order your essay today and save 30% with the discount code DISCOUNTS2022