assignment02 (1)

Upload: samoha-samoha

Post on 07-Oct-2015

25 views

Category:

Documents


0 download

DESCRIPTION

1111

TRANSCRIPT

Assignment 2Q1: Write a program that creates a LinkedList object of 10 characters, then creates a second LinkedList object containing a copy of the first list, but in reverse order.

Q2: Write a program that inserts 25 random integers from 0 to 100 in order into a LinkedList object. The program should sort the elements, then calculate the sum of the elements and the floating-point average of the elements.

Q3: Write a program that determines and prints the number of duplicate words in a sentence. Treat uppercase and lowercase letters the same. Ignore punctuation.

Q4: Write a program which creates a concordance of characters occurring in a string (i.e., which characters occur where in a string). Read the string from the command line. Use HashMap to store each character along with list of places where it occurs.Running the program:>java Concordance Hello World{d=[9], o=[4, 6], r=[7], W=[5], H=[0], l=[2, 3, 8], e=[1]}