The University of Western Australia
School of Computer Science and Software Engineering
 
 

School of Computer Science and Software Engineering

CITS1001 Object-oriented Programming and Software Eng

Labsheet 5 (for week 8)

This lab provides practice using arrays, library classes, and screen display facilities. The original version was written by Gordon Royle.

Create a folder Text analyser, and download these files.

The only class you need to modify is TextAnalyser.

Complete the walking skeleton of the TextAnalyser class. Search for TODO comments and use the comments and test cases to determine what each method must do. Each TODO is labelled with a number; the numbers indicate a suggested order in which to complete the methods.

You will need to use various static methods from the Character class in the Java libraries, in particular isLetter and toLowerCase; and also charAt from the String class. You also need to be aware that arithmetic operations can be applied to chars. Try typing these expressions into the Code Pad:

  • 'a'
  • (int) 'a' (i.e. 'a' cast to an int)
  • (int) 'b'
  • (int) 'z'
  • 'a' + 4
  • (char) ('a' + 4)
  • 'e' - 4
  • (char) ('e' - 4)
  • (int) 'A'
  • (int) ('A' + 25)
  • 'b' - 'a'
  • 'z' - 'a'

You will need to use operations like these in your code.

CHALLENGE (optional): Animate your histogram in interesting ways. If you create an interesting display, email your updated version of TextAnalyser.java to [email protected]. There will be a prize** for the best submission.

**All prizes are awarded or not solely at Lyndon's discretion.