1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
nataly862011 [7]
3 years ago
12

You should process the tokens by taking the first letter of every fifth word,starting with the first word in the file. Convert t

hese letters to uppercase andappend them to a StringBuilder object to form a word which will be printedto the console to display the secret message.
Computers and Technology
1 answer:
zhenek [66]3 years ago
5 0

Answer:

See explaination

Explanation:

import java.io.File;

import java.io.IOException;

import java.util.Scanner;

import java.util.StringTokenizer;

public class SecretMessage {

public static void main(String[] args)throws IOException

{

File file = new File("secret.txt");

StringBuilder stringBuilder = new StringBuilder();

String str; char ch; int numberOfTokens = 1; // Changed the count to 1 as we already consider first workd as 1

if(file.exists())

{

Scanner inFile = new Scanner(file);

StringTokenizer line = new StringTokenizer(inFile.nextLine()); // Since the secret.txt file has only one line we dont need to loop through the file

ch = line.nextToken().toUpperCase().charAt(0); // Storing the first character of first word to string builder as mentioned in problem

stringBuilder = stringBuilder.append(ch);

while(line.hasMoreTokens()) { // Looping through each token of line read using Scanner.

str= line.nextToken();

numberOfTokens += 1; // Incrementing the numberOfTokens by one.

if(numberOfTokens == 5) { // Checking if it is the fifth word

ch = str.toUpperCase().charAt(0);

stringBuilder = stringBuilder.append(ch);

numberOfTokens =0;

}

}

System.out.println("----Secret Message----"+ stringBuilder);

}

}

}

You might be interested in
(please help) What do you do if Brainly keeps saying your blocked?
kolezko [41]
You could probably make a new account if it’s just the account blocked
6 0
2 years ago
What is the basic similarities and difference between the three project life cycles model? ​
MAVERICK [17]

Answer:

Project life cycle is the time taken to complete a project, from start to finish.

The three project life cycles model include the following:

  • Predictive
  • Iterative and Incremental
  • Adaptive

Explanation:

Predictive project life cycles model: In this stage, the three major constraints of the project which are the scope, time and cost are analyzed ahead of time and this analysis is well detailed and the detailed scope of the project is done right from the start of the project.

Iterative and Incremental life cycles model: In this iterative and incremental model, the project is again split into stages that can be sequential or overlapping and at the first iteration of the project, the scope is determined ahead of time.

Adaptive life cycles model: Also in this stage, the project is split up into phases but because these phases are more rapid and ever changing unlike the other models, the processes within the scope can work in parallel.

Similarities

  • They make use of high level planning.
  • They are sequential and overlapping.
  • They make use of high level scope.

Differences

  • The predictive life cycle model makes use of a detailed scope at the beginning of a project while the other models make use of detailed scope only for each phase.
  • In predictive life cycle model, the product is well understood, in other models, the projects are complex and not easily understood.
  • There is periodic customer involvement in predictive and interative life cycle model while the customer involvement in the adaptive model, the customer model is continuous.

3 0
3 years ago
A certain social media Web site allows users to post messages and to comment on other messages that have been posted. When a use
vagabundo [1.1K]

D) To determine which posts from a particular user have received the greatest number of comments

<u>Explanation:</u>

Since social media excepting comments from end user website or social media should keep track of end user information such as name with email address and phone extra.

If we do so we can end user information in cans, end user post, wrong post information can be blocked or given end user information for further analysis.  Moreover web site can receive positive or negative posts.

For me all four will be my answer. If we don’t track any information about end user it is against to law.

4 0
3 years ago
A Venn diagram is used to show can somebody help plz
djyliett [7]
A venn diagram is used to show the similarities and the differences  <span />
3 0
4 years ago
Read 2 more answers
Anthony is responsible for tuning his organization's intrusion detection system. He notices that the system reports an intrusion
Alinara [238K]

The errror that has occured is a False Positive error.

Explanation:

  • A false positive is where you receive a positive result for a test, when you should have received a negative results.
  • A false positive (type I error) — when you reject a true null hypothesis.
  • The type I error rate or significance level is the probability of rejecting the null hypothesis given that it is true. It is denoted by the Greek letter  alpha
3 0
3 years ago
Other questions:
  • Before attempting the​ exercise, click here to watch a short video. Of the following list of tools used at Arnold Palmer​ Hospit
    14·1 answer
  • The font size on presentation slides should not be smaller than _____ -point.
    10·1 answer
  • Of the measures of feasibility in the accompanying figure, ____ considers points such as "Does the proposed platform have suffic
    14·1 answer
  • Which tasks can be completed using the Chart Tools Design tab? Check all that apply.
    9·1 answer
  • Time complexity: Be sure to show your work. Suppose that a particular algorithm has time complexity T (n) = 10 ∗ 2n, and that ex
    7·1 answer
  • FREEEEEEEEEEEEE FREEEEEEEEEEEEE Pointttssss​
    6·2 answers
  • The document that is use in excel to store an work with data that's formatted in a pattern of a uniformly space horizontalal an
    12·1 answer
  • In binary, if there is a 1 in the 1s place the number is always
    9·1 answer
  • Fields where computers are used include: business, education, banking, government, true or false​
    10·1 answer
  • Write a function that receives a StaticArray and returns an integer that describes whether the array is sorted. The method must
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!