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
Alex777 [14]
3 years ago
15

The CountLetters application is limited to counting letters in a single word. Modify the CountLetters application to count the l

etters 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]);
}
}

}
Engineering
2 answers:
insens350 [35]3 years ago
5 0
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
Bond [772]3 years ago
4 0
What are you trying to say here? do you need help? Or ..?
You might be interested in
What type of fire extinguisher is used for electrical fires.
AysviL [449]
The all purpose one will work or you could use type C I believe.
8 0
3 years ago
A dipstick is (a direct,an indirect) measurement device
icang [17]
Direct because it’s going right in the spot it needs to be in
3 0
4 years ago
A 60-cm-high, 40-cm-diameter cylindrical water tank is being transported on a level road. The highest acceleration anticipated i
dlinn [17]

Answer:

h_{max} = 51.8 cm

Explanation:

given data:

height of tank = 60cm

diameter of tank =40cm

accelration = 4 m/s2

suppose x- axis - direction of motion

z -axis - vertical direction

\theta = water surface angle with horizontal surface

a_x =accelration in x direction

a_z =accelration in z direction

slope in xz plane is

tan\theta = \frac{a_x}{g +a_z}

tan\theta = \frac{4}{9.81+0}

tan\theta =0.4077

the maximum height of water surface at mid of inclination is

\Delta h = \frac{d}{2} tan\theta

            =\frac{0.4}{2}0.4077

\Delta h  0.082 cm

the maximu height of wwater to avoid spilling is

h_{max} = h_{tank} -\Delta h

            = 60 - 8.2

h_{max} = 51.8 cm

the height requird if no spill water is h_{max} = 51.8 cm

3 0
4 years ago
An engineering student claims that a country road can be safely negotiated at 65 mi/h in rainy weather. Because of the winding n
igomit [66]

Answer:

Negotiated speed should be lower. Perception/reaction time is too less than design values.

Explanation:

Given:

- The claimed safe speed V_1 = 65 mi/h

- Sight distance D = 510 ft

- The practical deceleration a = 11.2 ft/s   ... according to standards

Find:

Assuming practical stopping distance, comment on the student whether the claim is correct or not

Solution:

- Calculate the practical stopping distance:

                      d = V_1^2 / 2*a

                      d = ( 65 * 1.46 )^2 / 2*11.2 = 402.054 ft

- Solve for reaction distance d_r is as follows:

                     d_r = D - d = 510 - 402.054 = 107.945 ft

- The perception/time reaction is:

                   t_r = d_r/V_1 = 107.945 / 94.9

                  t_r = 1.17 sec

Answer: The perception/reaction time t_r = 1.17 s is well below the t = 2.3 s.

Hence, the safe speed should be lower.

4 0
3 years ago
How did ancient machines pave the way for improvement
Leno4ka [110]

Answer:

----------

Explanation:

Ancient machines have paved the way for improvement by being the foundation for change. these machines made it possible to find flaws so in the next generations, they could fix, develop, and produce better quality machines. eventually this process has reached the present time but after today, the process will continue to produce even better quality machines than the time before. I hope this helps!

4 0
3 years ago
Other questions:
  • A Wheatstone bridge initially has resistances equal to R1 = 200Ω, R2 = 400Ω, R3=500Ω and R4=600Ω. For an input voltage of 5V, de
    12·1 answer
  • The Release Train Engineer is a servant leader who displays which two actions or behaviors?
    6·1 answer
  • Assume that the flow of air through a given duct is isentropic. At one point in the duct, the pressure and temperature are pl =
    15·1 answer
  • The water behind Hoover Dam in Nevada is 221 m higher than the Colorado River below it. At what rate must water pass through the
    6·1 answer
  • As soldiers get bigger and packs get heavier, a parachutist and load can weigh as much as 490 lbf. The standard 28-ft parachute
    11·1 answer
  • A train starts from rest at station A and accelerates at 0.4 m/s^2 for 60 s. Afterwards it travels with a constant velocity for
    11·1 answer
  • Fill in the truth table for output A. <br>A = (x+y)(x'+z')(x'+z')​
    6·1 answer
  • A chemical process stream enters a shell-and-tube exchanger at a temperature of 200.0°Fand does two passes on the shell side, ex
    15·1 answer
  • Why is it important to push a dolly instead of pulling it?
    14·2 answers
  • When the electrical connection to the alternator from the battery is not tight, it can cause?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!