We will need to use a variety of Character class and String class methods to  validate the data and separate it in order to process it. We will also use a Character class method to allow the user to continue the program if desired.  The String class’s split method will allow us to process the tokens in a text file in  order to decode a secret message. We will use the first letter of every 5th token read in  from a file to reveal the secret message.  Task #2 String.split and the StringBuilder Class  1. Copy the file secret.txt (Code Listing 9.3) from the Student Files or 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. Convert these letters to uppercase and append them to a StringBuilder object to form a word which will be printed to the console to display the secret message.  Code Listing 9.3 (secret.txt) January is the first month and December is the last.  Violet is a purple color as are lilac and plum.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

We will need to use a variety of Character class and String class methods to 
validate the data and separate it in order to process it. We will also use a Character
class method to allow the user to continue the program if desired. 
The String class’s split method will allow us to process the tokens in a text file in 
order to decode a secret message. We will use the first letter of every 5th token read in 
from a file to reveal the secret message. 

Task #2 String.split and the StringBuilder Class 

1. Copy the file secret.txt (Code Listing 9.3) from the Student Files or 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. Convert these letters to uppercase and
append them to a StringBuilder object to form a word which will be printed
to the console to display the secret message. 

Code Listing 9.3 (secret.txt)
January is the first month and December is the last. 
Violet is a purple color as are lilac and plum.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 2 images

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education