Question
hi need some help with a program, i have got this to setup like this with some help, but how would i change it to
hi need some help with a program, i have got this to setup like this with some help, but how would i change it to the modification listed below, aka best way to do it
Modify the program of Fig. 16.18 to count the number of occurrences of each letter rather than of each word. For example, the string "HELLO THERE" contains two Hs, three Es, two Ls, one O, one T and one R. Display the results.
Run your program with the following string: Hi there, I am taking Java Programming (Intermediate).
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
public class Generic_Collection {
public static void main(String a[]) {
LinkedList
list.add('F');
list.add('G');
list.add('U');
list.add('V');
list.add('L');
list.add('A');
list.add('I');
list.add('D');
list.add('R');
list.add('P');
System.out.println("Actual LinkedList:" + list);
List
listCopied.addAll(list);
//Reverse the listCopied.
Collections.reverse(listCopied);
System.out.println("List: " + list);
System.out.println("Copy List: " + listCopied);
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started