The CountLetters application is limited to counting letters in a single word. Modify the CountLetters application to count the letters in an entire phrase, which contains spaces. Care must be taken to ignore the spaces and any other non alphabetic character found in the phrase. Be sure to change comments and variable names appropriately so that the reader of the application code understands that the letters in a phrase are counted.


import java.util.Scanner;

public class CountLetters {

public static void main(String[] args) {
final int LOW = 'A'; //smallest possible value
final int HIGH = 'Z'; //highest possible value
int[] letterCounts = new int[HIGH - LOW + 1];
Scanner input = new Scanner(System.in);
String phrase;
char[] wordLetters;
int offset; //array index

/* prompt user for a phrase */
System.out.print("Enter a phrase: ");
phrase = input.nextLine();
input.close();

/* convert word to char array and count letter occurrences */
phrase = phrase.toUpperCase();
wordLetters = phrase.toCharArray();
for (int letter = 0; letter < wordLetters.length; letter++) {
offset = wordLetters[letter] - LOW;
letterCounts[offset] += 1;
}

/* show letter occurrences */
for (int i = LOW; i <= HIGH; i++) {
System.out.println((char)i + ": " + letterCounts[i - LOW]);
}
}

}


Answers

Answer 1
what are you trying to say here? do you need help? Or ..?
Answer 2
You can’t put it lines of code like that it’s not that easy to figure out what your trying to say in Java script

Related Questions

Which of the following will help sober up and lower the BAL of an intoxicated person? Exercise Black coffee Time A cold shower

Answers

Where are the following to these questions ?

Answer:

Time

Explanation: time gives the liver the chance to do its job and metabolize the alcohol. Although...exercise can help wake up the body and make a person more alert. It may also help metabolize alcohol more quickly, although the scientific evidence of this is inconclusive.


Given half a chance, other people at work will take advantage of you.

Answers

Answer:

T

Explanation:

True

Yes they will
Some people will thank you for the opportunity given
Mostly people won’t care ,they’ll use u when they need u and ignore u after that
So ,u better make full use of it

Which option identifies the technology that controlled flooding in the following scenario? The Nile River in Egypt floods its banks from melting snow and heavy rains every year. Since 1970, flood control has been managed by the Aswan High Dam. terps locks polders sluice gates HELP PLEASE

Answers

Answer:

The correct option is;

Since 1970, flood control has been managed by the Aswan High Dam

Explanation:

The scenario that identifies the technology that controlled flooding is the flood control that is being managed by the Aswan High Dam

Dams alongside their reservoirs are meant control the flow water and to protect low-lying areas from disastrous floods. Damming a water way involves the construction of a standardized dam complementary standard water reservoir with the water within it being kept below a certain level to allow it accommodate water coming from floods.

Terps are artificial mounds meant for dwelling

Polders are water body reclaimed low-lying land by the construction of drainage canals and d y k e s

Sluice gates are meant to harness the power of flowing waters.

The correct option is; Since 1970, flood control has been managed by the Aswan High Dam

What type of damage is reduced by installing impact resistant glass functional shutters and double door top and bottom latches

Answers

Answer: you are reducing bullet damage or the damage of a person getting shattered glass all over them

Explanation: i dont

have one

Hinges will out weigh the needed amount

1. If the correct precautions are not taken, working on automobiles can be

Answers

Difficult/ close to impossible
May cause many accidents, they may fire u from the job
Other Questions
The ninjas were still chasing me so I lead/led them downstairs. Which point is not in the solution set of the equation 3y + 2 = x2 5x + 17? A) (-2,10) orD) (5,5)B and C where wrong. Find the value of k such that the quadratic equation x(x-2k)+6=0 has real and equal roots 5.Some people believe George Washington was the greatest president of the United States because he was the very first president.This statement is an example of which of the following?experimentationdataopinionresearch what is the capital of Ghana and also Togo. Pick an EPA funded environmental justice project & summarize the project description. Identifying Cost Drivers in an ABC systemPatterson makes electronic components for handheld games and has identified several activities as components of manufacturing overhead: factory rent, factory utilities, quality inspections, materials handling, machine setup, employee training, machine maintenance, inventory security costs, and supervisor salaries. For each activity that Patterson has identified, choose a cost driver to allocate that cost. Explain your reasoning. against the foregoing background obtain any road road traffic policy and demonstrate your understanding of that particular policy in relation to its level. in your discussion indicate your role as traffic a prospective traffic law enforcement personnel A pet store has three fish tanks, each holding a different volume of water and a different number of fish. Tank AAA holds 40\text{ L}40 L40, start text, space, L, end text and 555 fish. Tank BBB holds 100\text{ L}100 L100, start text, space, L, end text and 121212 fish. Tank CCC holds 180\text{ L}180 L180, start text, space, L, end text and 232323 fish. Order the tanks by volume per fish from least to greatest. A farmer was interest in determining how many grasshoppers were in his field. He knows that the distribution of grasshoppers may not be normally distributed in his field due to growing conditions. As he drives his tractor down each row he counts how many grasshoppers he sees flying away. After several rows he figures the mean number of flights to be 57 with a standard deviation of 12. What is the probability of the farmer will count 52 or fewer flights on average in the next 40 rows down which he drives his tractor 1. How is it possible to use pools to model apparent weightlessness, similar to what astronautsexperience on the Moon or on the space station? Explain MULTIPLE CHOICE / Will Impact On Other Homeschoolers / Will Mark BrainliestStage Set: Syd's room. Tom and Kate are unaware of the fact that Syd, who had gone out to help a friend with homework, has returned home early. He is eavesdropping on his parents' conversation.TOM:Can you believe it? Our son going off to college?KATE:Wow. Seems like he was born yesterday. He was a tiny little thing at five pounds. Now, he is going on a football scholarship.TOM:How did we get so lucky?KATE:I think he is pretty lucky, too. I did not get a new car until I was 28.TOM:Well, he is an excellent driver, and he will be driving home every other weekend.KATE:You think he will be like that?TOM:Our kid? He appreciates your dinner every night. You think he is not going to like the new car? He'd be thrilled!KATE:I wish I could kiss good night and tuck him in like when he was a baby.TOM:Well, good thing he is not home. He would be so embarrassed. He is 17!Which of these best explains the irony in this play?A. The parents falsely believe that Syd is an excellent driver.B. Only the audience knows that Syd is actually in his room.C. Only the father knows that the son really hates football.D. The parents have bought a new car for a teenager. i hate math bro please help me Pam wants to buy a DVD player. The original price is $50. What is the sale price? with a 90% off OMG HELP MEEERead the sentence and answer the question that follows.Several cute tiny tadpoles darted through the muddy shallow water.For clues about possible places for commas, draw a box around adjectives wherever two or more are together. Using this strategy, which words would be boxed?A. cute, tiny, the, muddy, shallowB. cute, tiny, muddy, shallowC. several, cute, muddy, shallowD. several, cute, tiny, muddy, shallow What is the value of 36/5 (10/9 5/6 ) ? Standard written English includes which of the following?? In the figure, BE||CD. Solve for x. Show your work. If a function f(x) is defined as 3x2 + x + 2, what is the value of Lim h-0 f(x+h)-f(x)/h? A. 3x + 1 B. 3x + 2 C. 6x + 1 D. 6x + 2 How did a belief in states rights hamper the South during the war?