ITEC 120 LAB 17 Back to Lab index page

Fun with arrays

Write a program which will read in some number of characters. You will use a char array. (You only need one java file with a main method for this project.) Your program will:

Sample run:

Program outputs: How many characters do you want to type in?
User inputs: 8
Program outputs: Enter character 1:
User inputs: a
Program outputs: Enter character 2:
User inputs: b
Program outputs: Enter character 3:
User inputs: c
Program outputs: Enter character 4:
User inputs: 5
Program outputs: Enter character 5:
User inputs: !
Program outputs: Enter character 6:
User inputs: X
Program outputs: Enter character 7:
User inputs: Y
Program outputs: Enter character 8:
User inputs: Z
Program outputs: There were 3 uppercase letters.
There were 3 lowercase letters.
There were 2 characters that were not letters.

abc5!XYZ
ZYX!5cba

Once you have your program working, show your lab to the Peer Instructor to be checked off. Run the program with lab17in.txt as input.