Computer Science, asked by jeannelizelias, 4 months ago

A series of country names are stored in an array. You have been asked to count the country that starts with letter ‘a’ in java.

Answers

Answered by purneetkaur93
0

Answer:

I'm interested in how to count the number of names in a queue that begin with the same first character.

My program will be asking the user to input several names, and the names will be stored in a queue. However, I am required to count the number of names in the queue that begins with the same first character. How do I do that? I'm new to java so I don't know much.

It should print the following statistics:

- The total number of country names in the queue that begins with the same letter.

- To compute the above statistics you may use other data structures, such as Array, or ArrayList/Vector.

Example:

User inputs/what is in the queue:

Brazil

Italy

Singapore

Spain

Switzerland

Iceland

Output:

Total number of countries start with I : 2

Total number of countries start with S : 3

I've tried searching around on this but I haven't really found a solid method to do this. Any help would be greatly appreciated.

NOTE: I am not allowed to use any of Java's mechanisms and have to implement it myself

here's my program so far.

Similar questions