Lab 3: Java types

The goal of this lab is to exercise your understanding of Java types and practice the recent Java constructs you have seen.

I. Palindromes, redux

First open a terminal window.

We'll do one more set of modifications to the palindrome program. To get started, grab a copy of the version from class:

mkdir lab3
cd lab3
cp /cslab/class/csci235/lab3/Palindrome.java .

The first change to make is to make the program work for input with mixed case. You may find it helpful to check the available methods on class String.

II. Pangrams

Your previous program tests whether a string is a palindrome. In exercises II and III, you will be writing programs for two other word games.

A sentence is a pangram if it contains every letter of the alphabet at least once. Examples include

Write a program which prompts the user for a string and determines whether or not that string is a pangram. Ignore spaces, punctuation, and capitalization. Your program should also include an opening documentation block (following the style we've seen in class) and a comment on every variable you declare.

III. Anagrams

Two words or phrases are anagrams of each other if they contain all the same letters (with the same frequency). Examples include

Write a program which prompts the user for two strings. Test whether the two strings are anagrams of each other. Ignore spaces, punctuation, and capitalization. Your program should also include an opening documentation block (following the style we've seen in class) and a comment on every variable you declare.

Turning it in

Make a script file that shows you compiling your programs and running them with inputs that make it clear that they work correctly. (See how to script,)

Print your three .java files. (See how to print,)

Use handin to hand in the files as lab3, too. (See how to do that, too.)


Updated by Cary Gray,
original by Thomas VanDrunen
Last modified: Tue Sep 14 11:17:01 CDT 2010