JMU
logoArchetypes.png
Programming Assignment 6


1 Overview: Professor Emeritus J. Archer "Arch" Harris, retired a couple of years ago and has started a company, Archetypes, located in the wilds of North Carolina. His first product was a room-cleaning robot named Roombarch. Now he is developing an electronic scoreboard (initially for use in diving competitions) named ArchRival. Since he doesn't have much financial backing, he has asked the department to force the students taking CS139 to work for him for free. We have agreed. In other words, you have "volunteered" to write some of the classes for the initial version of ArchRival.
2 Parts: This assignment is divided into several parts, each of which will be graded individually. You should (but are not required to) complete all parts of this assignment in order. The later parts are based on the earlier parts and you may (indeed, should) use your answers to the earlier parts to complete the later parts.

a. A demonstration that you understand the problem. Click here to go to Blackboard. (You may attempt this part of the assignment multiple times. You should, but are not required to, earn a grade of 100% before proceeding.)

b. A demonstration that you understand Java well enough to complete the assignment. Click here to go to Blackboard. (You may attempt this part of the assignment multiple times. You should, but are not required to, earn a grade of 100% before proceeding.)

c. A utility class that that can be used to calculate the raw score and the total score for a dive based on the scores given by individual judges. Click here for the requirements.

d. The main class for a prototype that demonstrates the capabilities of the system. Click here for the requirements.

3 Getting Started: Before doing anything else, you should create a directory/folder (e.g., named pa6) that will hold all of the files for this assignment.

You must download the following .class files:

and read and understand the documentation (especially about the "Fields", "Constructors" and "Methods") describing these classes:

You must also download the following bitmap image files (in .png format):

Finally, before doing anything else, you should read the requirements/design documents for the ScoreCalculator and ArchRival classes so that you understand the problem.

4 An Important Change: You must not use the Text class for this assignment (or, indeed, any longer in this course). The Text class was created just for this course to make things more convenient for the early assignments. You must, instead, use "standard" Java classes.

For this assignment, you might find the Double.parseDouble(java.lang.String) java.lang.Double#parseDouble(java.lang.String) and Integer.parseInt(java.lang.String) java.lang.Integer#parseInt(java.lang.String) methods useful.

5 Some Advice: As we have discussed all semester, there are many ways to solve most problems, and problem-solving/design involves formulating/identifying multiple solutions and choosing the best solution. For this assignment, it will be particularly important that you follow this advice.

In particular, there are many different ways to implement the ScoreCalculator class, and the most obvious approach (i.e., the approach that most people think about first) is probably not the best. Indeed, it is very likely that the approach you think of first will seem easy at the beginning but will be very difficult to complete. So, before you start "typing", try to come up with multiple solutions and then choose the one you think is best.

6 Submitting Your Code: You must submit the code you write for Part c and Part d independently using Web-CAT (and the Blackboard attestation process). Specifically, after you complete your ScoreCalculator class you must submit it using Web-CAT (and the Blackboard attestation process). Then, after you complete the ArchRival class you must submit it (along with the ScoreCalculator class) using Web-CAT (and the Blackboard attestation process).
7 Testing Your Code: You must test your ScoreCalculator class and your ArchRival class independently.


7.1 Testing the ScoreCalculator Class
Given the due date for this part of the assignment, you need not develop a driver for testing your implementation of the ScoreCalculator class. However, to reduce the burden on the Web-CAT server, you should test your implementation using PA6cTestSuite.jar. As before, you will need to copy junit.jar to the working directory for this assignment. (PA6cTestSuite.jar uses the exact same tests cases as Web-CAT. So, if your code passes these tests it will pass the Web-CAT tests.)


7.2 Testing the ArchRival Class
First, you must bench check your ArchRival class to make sure that it is correct. In particular, you should ensure that your ArchRival class constructs exactly two ScoreBoard objects. (An implementation that constructs fewer or more than two ScoreBoard objects will be given a grade of 0.)

Then, you must test your ArchRival class "by hand".

Test 1 is a simple test in which there are two divers at each meet, both of whom perform one dive. The user input for test 1 is (where the last "N" is omitted so that the program does not terminate):

JMU
Flintstone Wilma
1 3 0 B
5.5 5.0 6.0 6.5 6.0 6.5 5.0
Y
JMU
Rubble Betty
4 5 0 B
4.5 4.5 4.5 5.0 5.5 5.0 5.0
Y
Stanford
Moose Bullwinkle
1 4 0 B
3.0 2.5 2.0 3.5
Y
Stanford
Squirrel Rocky
4 2 0 C
8.0 9.0 8.5 8.5
    

Note that token 0 of the description of the dive corresponds to the group and token 3 of the description of the dive corresponds to the position. For example, Wilma Flintstone's dive has a group of "1" (which is Dive.FORWARD) and a position of "B" (which is Dive.PIKE). So, you needn't do anything to convert the group or position.

The correct output for this test is:

Test1-Expected-JMU.png
Test1-Expected-Stanford.png

Test 2 is a slightly more complicated test in which there are two divers at each meet, but now one diver at each meet performs one dive and the other performs two dives. The user input for test 2 is:

JMU
Flintstone Wilma
1 3 0 B
5.5 5.0 6.0 6.5 6.0 6.5 5.0
Y
JMU
Rubble Betty
4 5 0 B
4.5 4.5 4.5 5.0 5.5 5.0 5.0
Y
Stanford
Moose Bullwinkle
1 4 0 B
3.0 2.5 2.0 3.5
Y
Stanford
Squirrel Rocky
4 2 0 C
8.0 9.0 8.5 8.5
Y
JMU
Flintstone Wilma
1 1 2 A
8.5 8.0 8.0 8.5 8.0 8.5 9.0
Y
Stanford
Squirrel Rocky
3 5 5 B
9.5 9.5 9.0 9.5
    

The correct output for this test is:

Test2-Expected-JMU.png
Test2-Expected-Stanford.png

Test 3 is a slightly more complicated test in which there are are a different number of divers at the two meets, and the different divers perform different numbers of dives in different orders. The user input for test 3 is:

JMU
Flintstone Wilma
1 3 0 B
5.5 5.0 6.0 6.5 6.0 6.5 5.0
Y
JMU
Rubble Betty
4 5 0 B
4.5 4.5 4.5 5.0 5.5 5.0 5.0
Y
Stanford
Moose Bullwinkle
1 4 0 B
3.0 2.5 2.0 3.5
Y
Stanford
Squirrel Rocky
4 2 0 C
8.0 9.0 8.5 8.5
Y
JMU
Flintstone Wilma
1 1 2 A
8.5 8.0 8.0 8.5 8.0 8.5 9.0
Y
Stanford
Squirrel Rocky
3 5 5 B
9.5 9.5 9.0 9.5
Y
Stanford
Badenov Boris
2 5 1 B
3.5 2.0 2.5 1.0
Y
Stanford
Fatale Natasha
3 4 0 C
4.0 4.0 4.0 4.0
Y
JMU
Rubble Betty
4 7 0 B
4.5 4.5 4.5 4.5 4.5 4.5 4.5
Y
JMU
Flintstone Pebbles
1 1 0 C
8.0 8.0 8.0 8.0 8.0 8.5 8.5
    

The correct output for this test is:

Test3-Expected-JMU.png
Test3-Expected-Stanford.png

After testing your implementation by hand, to reduce the burden on the Web-CAT server, you should test your implementation using PA6dTestSuite.jar. As before, you will need to copy junit.jar to the working directory for this assignment. (PA6dTestSuite.jar uses the exact same tests cases as Web-CAT. So, if you code passes these tests it will pass the Web-CAT tests.) You will also need to download the following files (which contain test 3 and a textual description of the expected results) to your working directory.

Going Further


Copyright 2013