JMU CS345 - Software Engineering
Help Policies Solutions Study-Aids Syllabus Tools
Homework: OOP Input/Output Review


1 Purpose

The primary purpose of this assignment is to help you review (and demonstrate that you have acquired) the knowledge and skills required to perform basic input/output in Java. From a language and algorithms perspective, there is nothing new in this assignment. There is also nothing new from a software engineering perspective.

2 Overview

As you know from an earlier assignment, perspecTV is a (fictitious) company that designs, creates and markets products that provide a new perspective on television. Their products make television both more interactive and more informative. They are in the process of developing a suite of products called forScore for judged competitions of various kinds (e.g., sporting events like diving and gymnastics, singing contests, dance competitions).

v1 of their forScore application (which was named IndividualScorer) worked with a hard-coded competition structure. v2 of the forScore application (which is named PeopleScorer) must read the competition structure and scores from a file.

3 Starting Point

This assignment builds on H1. You may start with either your solution to H1 or my solution to H1. However, there is no guarantee that my code is correct; you are responsible for any and all mistakes in your submission.

4 Documents

perspecTV Media has created several new documents for this version.

5 Testing

Some of the tasks that you must complete involve unit testing. You must use JUnit for this purpose. Your JUnit test suite must cover all statements and all branches (as measured by EclEmma) in all of the classes/enums you submit, including the classes/enums from earlier assignments (whether you actually wrote them or I did). You should neither write tests for, nor submit, the PeopleScorer class. Your tests must be in a package named testing and each test class must include the word "Test" in its name.

Note that it will be difficult to test the DivFileReader class directly. Instead, you will need to test it by ensuring that the objects it constructs (i.e., the Dive and DiversList objects) are correct. Since each module can't be tested in isolation, this is a form of integration testing.

6 A Recommended Process

As before, the tasks that were identified by the team at perspecTV are organized by story. Hence, though they are numbered so that they can be referred to in documents and conversations, the numbers should not, in any way, influence the order in which you complete them. I would suggest you sequence your activities as follows. (Note: This process is intended to give you some experience with TDD, test-driven development, in which tests are written before the code to be tested.)
  1. Read and understand all of the design documents. If you have questions, ask them. In particular, make sure you understand what "immutable" means in the context of this project (because the definition can be complicated when objects have attributes that are reference types).
  2. Create a new project for this version and copy the classes from the previous version to do this one. (We'll talk about other ways to deal with this issue later in the semester.)
  3. Stub-out (including comments) all of the new components.
  4. Write tests for the Dive class.
  5. Implement the Dive class.
  6. Test and debug the Dive class.
  7. Write tests for the DiversList class.
  8. Implement the DiversList class.
  9. Test and debug the DiversList class.
  10. Implement the readDive() method in the DivFileReader class.
  11. Create tests for the readDiversList() method in the DivFileReader class.
  12. Implement the readDiversList() method in the DivFileReader class.
  13. Test and debug the readDiversList() method (and, indirectly, the readDive() method).
  14. Test and debug the complete system.

7 Submission

You must submit (using Gradescope) a .zip file that contains:
  1. "Your" implementation of the required interfaces/classes/enums in the appropriate package(s) (including the DifficultyTable1mS class but not including the PeopleScorer class).
  2. JUnit tests for all of the classes/enums you submit (in a package named testing).

Do not submit the data files, they will be provided by the autograder in the appropriate location (as discussed below).

There is no limit on the number of submissions and no penalty for excessive submissions.

8 Grading

Your submission will be graded as follows:

Note that some criteria are described as being "Success Required". This means that Gradescope will not assess subsequent criteria unless these criteria are satisfied (and you will receive a grade of 0 for those criteria). So, for example, if your code does not conform to the style guide then it will not be assessed using any subsequent criteria and you will receive a grade of 0.

As always, points will be deducted for code that is unclear, inelegant, and/or poorly documented.

9 Help

9.1 Help Using a BufferedReader

Text files often use multiple delimiters, the delimiters that separate fields and the newline character that separates records (or lines). When using a BufferedReader (rather than a Scanner) you will read an entire record (including the newline character) using the readLine() method. You will then tokenize the entire record using a StringTokenizer or the split() method in the String class.

9.2 Help with the Data Files

You should download the .zip file containing the data files into the downloads directory/folder that you created for this course. You should then unzip them in that same directory. After you have unzipped the data files you must open a file explorer or finder, select all of the files, and drag them into Eclipse. Specifically, you must drag them into the project (not the src directory/folder or anything underneath it).

Then, in your code that needs to use these files (e.g., your tests), you should use only the file name (i.e., do not include a path). For example, you might construct a BufferedReader named in as follows:

BufferedReader in = new BufferedReader(new FileReader("ST_Complete_01.div"));

It is possible to put the data files elsewhere, but then, when you submit your solution, your code will not be able to find them. In other words, for your code to work both on your computer and on the submission system, the data files must be dragged into the Eclipse project.

9.3 Tetsing for the IllegalArgumentException

The files bad_length_01.div and bad_length_02.div contain dives in which the number of scores is not consistent with the number of judges. You should use these files when testing for the IllegalArgumentException.

Copyright 2024