INFO-I211 Lab 4
??? Palindrome Tester GUI ???
Due date: see Oncourse Modules or Assignments
50 points
Due date: see Oncourse Modules or Assignments
50 points
This assignment is likely to change.
(ADD DETAILS: Unix Tutorial part 6: gzip, file, diff, etc.)
A palindrome is a string that reads the same backwards and forwards, such as "abcba". A palindrome tester program allows a user to enter a palindrome candidate (a string), and determines whether the candidate is actually a palindrome or not.
This lab has two stages. In the first stage, you should build a graphical user interface (GUI) for a palindrome tester. In the second stage, you implement the actual palindrome tester.
Prerequisite for Stage 1: GUI material in chapters 1–4.
Prerequisite for Stage 2:
sections 5.1–5.4 (if and while
statements, nested loops) and 5.7 (determining event sources).
Build the graphical user interface. It needs components for user input of the palindrome candidate and to display the test result, and buttons to test the candidate and to quit from the program.
output.setEditable(false)
so the user cannot enter text in it.
System.exit(0).
actionPerformed
method for the action listener should implement a "dummy" action,
such as displaying "I don't know"
in the result area, instead of actually testing whether the
input is a palindrome. You will add the actual testing
in Stage 2.In this stage, replace the dummy action of Stage 1 with actual palindrome testing. You may use as much or as little code from Listing 5.9 (pp. 237–238) as you wish; if you use it, you'll need to modify it to use the GUI developed in Stage 1, instead of console I/O. (Think of it as converting a legacy program to a flashy new user interface.)
If you use the provided code (Listing 5.9), you'll also need to fix an error. The empty string ("") is a palindrome, since it reads the same forward and backward, but the provided code does not handle it correctly. Kill this bug.
Turn in, as attachments in Oncourse assignments, your source code and screenshots demonstrating your program with the following palindrom candidates as test data: "tamat", "rxxr", "rxxy", "rxyr", and "" (the empty string).
Grading: 80% correctness (40 points: 10 for palindrome testing, 30 for GUI) ; 20% (10 points) program style. The Coding Standards for chapters 1–6 apply to this assignment.