CIS 120 Lab 9 Fall 2007

Name:_____________________________
Section:________
CIS 120-101 / Overstreet / Fall 2007
Lab 9 – Due: Week 10 (Wed 10/24/07)
Problem Description:
Design and implement a Java program with a class called “Lab9” that will keep track of the number of
points scored by two players in a series of games and display a game by game comparison of who scored
more points. The program will ask the user to input the number of games played. Then ask for the name of
each of the players. The players’ will then be prompted to enter their points scored for each game. The
points scored by each player will be compared for each game. Finally, a dialog box will display which
player scored more points and how many more points they scored for each game played. If the players
score the same number of points, the output will indicate that outcome.
Error Checking:
The program must force the user to enter a positive number of games (0 is not a positive number). You
must also handle the case of the user clicking cancel when asked for any input. If cancel is clicked, a
message should be indicated that cancel was clicked and the program should exit. You do not have to check
for non-integer input for number of games or points scored.
Coding Requirements
You must store each player’s points in an array.
The title bar of your output must display the same information as the example output with the exception
that you will replace Faculty with your first and last name.
You must have the following user-defined methods in your program.
Method Signature and Return Type
Purpose
void inputScores(int[ ] , String )
Prompts the user to enter a score for each game. An
array to hold the player’s scores and the player’s name
will be passed to this method.
void compareScores(int[], int[] , String, String)
Compares the scores of the two player’s game by
game and outputs which player scored more points
and by how much. If the players score the same
number of points, the output will indicate that
outcome. (See example output) The two arrays
holding each player’s scores and their names will be
passed to this method.
Filename Requirements:
Your program must be saved to a file called Lab9.java
You must submit a printed and electronic (CD or Floppy) copy of your commented program along
with a printed copy of your problem analysis, pseudocode, completed data dictionary, completed test
design table and screen captures of the input and output for all test runs in a manila envelope.
Problem Analysis - all inputs, processes, and outputs described. You must also include any formulas or
constants in the problem analysis.
Pseudocode – These steps should be detailed enough for you to transform each English-like statement into
Java statements.
Data Dictionary (You may add additional lines)
Variable Name
Type
Usage
Test Design (You must input that at least 5 games were played)
Game
Player 1 Points
Player 2 points
Output
1
2
3.
4.
5.
Input
Associated Output
CIS 120 Lab Assignment 9 Cover Sheet
Grade ____________
Name (Print): __________________________________________ Student #: _________
Spring 2007 Instructor: _________________________________ Section: ___________
Your program documentation should be labeled and organized according to the following:
DOCUMENTATION and DESIGN: 30% Paper copy and electronic copy are mandatory.
_____5 pt.
_____10 pt.
_____5 pt.
Problem Analysis
Identification of inputs, processes, and output
Algorithmic Design:
Pseudocode – Clearly Written and Understood
Correct Solution
Corresponds to program
Data Dictionary
All data and data types specified
Appropriate names chosen
Correct data types chosen
_____10 pt.
Test Design and corresponding program output
Minimum of five documented test cases with screen captures of the
associated input/output for each case. Your test design cases must
exercise all paths through your program.
Displays correct input and output expected by program.
PROGRAM: 70%
Paper and electronic copy of your source code submitted in a manila
envelope.
_____5 pt
Proper global documentation (at the top). See lab 1 programs for an
example.
_____5 pt.
Internal documentation and comments. See lab 1 programs for an example.
_____10 pt.
Style (indentation, spacing, blank lines, correct capitalization of identifiers
based on coding convention, line breaks and line continuations used
appropriately, output is clear and correctly formatted, etc.)
_____ 5 pt.
Meaningful identifiers - matches data dictionary
_____45 pt.
Correctness of program. Including: Program compiles, program runs,
produces correct output