CSE1OOF Sydney, 2020

Assignment B & C – Part 1

This is an individual Assignment. You are not permitted to work as a Pair Programming partnership or any other group when writing this assignment.


Due Date

Part 1 15%, Due: Wednesday 3 rd February at 12 p.m.

Part 2 15%, Due: Wednesday 10th February at 12 p.m.

Delays caused by computer downtime cannot be accepted as a valid reason for a late submission without penalty. Students must plan their work to allow for both scheduled and unscheduled downtime. There are no days late or extensions on this assignment. After the submit server has closed, NO assignments can be accepted.


Copying, Plagiarism

Plagiarism is the submission of somebody else’s work in a manner that gives the impression that the work is your own. The Department of Computer Science and Information Technology treats academic misconduct seriously. When it is detected, penalties are strictly imposed. Refer to the subject guide for further information and strategies you can use to avoid a charge of academic misconduct.


Assessment Objectives

Testing techniques covered in:

  All Lectures covered in CSE1OOF

  All Workshops covered in CSE1OOF

  All Labs in CSE1OOF


Submission Details and marking

Submissions should be through the LMS.


Marking summary

This assignment is worth 30% of your final mark in this subject. Part 1, 15% and Part 2, 15%

Instant zeros or heavily reduced marks
Not submitting code
Using code that has not been taught yet
Uses System.exit()


Using code not taught in OOF

Please also note carefully that whilst we encourage innovation and exploring java beyond what has been presented in the subject to date, above all, we encourage understanding.

All of the Tasks that follow can be solved using techniques that have been presented in lectures, lecture / workshops and labs so far. You do not need any external information.

These are the techniques and knowledge that we will later be examining in the Real Time Test (20 marks) and the exam (20 marks).

Code and techniques that are outside the material presented will not be examined, of course.

You are only allowed to use techniques that have been covered in the following:

  All Lectures covered in CSE1OOF

○  All Workshops covered in CSE1OOF

○  All Labs in CSE1OOF


Electronic Submission of the Source Code

●  You submit your files from your LMS account.


Background - Limitations and Notes

Error checking

In this program you can assume that the data in the input files are without errors and are in the specified format. Unless otherwise specified.

File name

The input must accept any file name, i.e. do not hard code the file name.

Variable names

All variables must use camelCase and be meaningful                     Lecture 4 – pg.8

Class names

All classes must use TitleCase as provided                     Lecture 4 – pg.8

Indentation

All code must be appropriately indented                     Lecture 4 – pg.8

Documentation

Your student number and a small unique description of the class must be included at the top of each class, as shown below


Classes

If you cannot get all tasks working, each class will be tested separately. Hence it is very important that you follow the Team given, and get each class working before moving onto the next.


  Key Points Repeated:

There are no days late or extensions on this assignment.
Your code must compile and display a result to the screen.
Using any techniques outside of the lectures, workshops and labs specified will result in a mark of 0 for the entire assignment.
This is an individual Assignment.
You must use structured programming

Finish one class at a time in the order given to maximise understanding and marks

Background

You are tasked with creating a system that manages the tennis player/team/tournament database.

The system is menu driven. And the user can choose to: (to be done in Part 2)

Add Player

Start Tournament

Add Team

Add Manager to Team

Sign Player

Display Player

Display Manager

Display Team

Display Total Number of Players


The players are loaded into the system from a file at the start of running the program, and can not be changed once loaded. (to be done in Part 2)

A player consists of its name, age and country code.

A Team consists of a player and a manager.

A tournament can carry up to max Teams registered (8 in this example), it has an id and a prize.

A manager has a name.


When a Team is added, a tournament must exist. A Team can only have one manager.

A tournament can only be started if there is at least 2 Teams and the tournament exist.


Create each class following the UML diagram, descriptions and tests.


A test class is provided for you to test two of the classes as you develop.

If the entire program does not work, a similar version will be used for marking.

Hence it is VERY important to get each working individual before proceeding to the next to maximize potential marks and feedback.


It is recommended you add to the tests provided or create your own tests, to cover all possible scenarios.

You must use the attributes and methods provided in the UML diagrams and base template

You can add private helper methods if you want to any class


Templates are provided for all classes required.

A tester is provided for Team and Player classes.

Three input files are provided


Class 1 – Manager.java


Manager
  - String name
  + Manager(String name)
  + String getName()
  + String toString()


Methods

Manager constructor

Initializes name attribute based on value passed

getName

Accessor for name attribute

toString

Returns String description of object

(Format as shown in ManagerTester class)

Test class

Compile and Run, ManagerTester.java

The expected values should match the actual values.


Class 2 – Player.java


Player
  - String name
  - int age
  - String countryCode
  + Player(String name, int age, String countryCode)
  + String getName()
  + int getAge()
  + int getCountryCode()
  + String toString()


Methods

Player constructor

Initializes attributes based on value passed

getName, getAge, getCountryCode

Accessors for specified attributes

toString

Returns String description of object

(Format as shown in PlayerTester class)

Test class

Compile and Run, PlayerTester.java

The expected values should match the actual values.


Class 3 – Team.java


Team
  - String TeamName
  - static int totalNumOfTeams = 0
  - Manager manager
  - Player player
  + Team(String TeamName, Player player)
  + String getTeamName()
  + boolean hasManager()
  + void setManager(Manager manager)
  + Player getPlayer()
  + Manager getManager()
  + static int getTotalNumOfTeams()
  + String toString()


Static Attribute

totalNumOfTeams

This static attribute (class attribute) tracks the total number of Teams.

(Make sure to read the lectures how to use this, very important knowledge)


Methods

Team constructor

Initializes TeamName and player based on the values passed (manager should be null, as there is no manager assigned yet)

Increments totalNumOfTeams

hasManager

Returns true if manager is not null and false if manager is null

setManager

Mutator for manager attribute

getTeamName

Accessors for team name

getTotalNumOfTeams

Static accessor (class accessor) for the static attribute totalNumOfTeams

(Make sure to read the lectures how to use this very important knowledge)

getPlayer

Accessor for player

toString

Returns String description of object

(Format as shown in Example Output)


Class 4 – Tournament.java


Team
  - int tournamentID
  - double prize
  - Team[ ] Teams
  - int numTeamsRegistered
  - final int MAX_TEAMS_REGISTERED = 8;
  + Tournament(int tournamentID , double prize)
  + int getTournamentID()
  + int getNumTeamsRegistered()
  + Team getTeam(int index)
  + Team[ ] getAllTeams()
  + void registerTeam(Team Team)
  + String toString()


Methods

Team constructor

Initializes tournament id based on value passed

Initializes tournament prize based on value passed

Set numTeamsRegistered to 0

Create the array Teams of length MAX_TEAMS_REGISTERED (in this example, 8 )

getNumTeamsRegistered, getTournamentID

Accessors for specified attributes

registerTeam

Adds a Team based on value passed if there is room.

The Teams array is filled from start to end

The number of Teams on board is incremented when a Team is added

getTeam

Accessor for team at index

getAllTeams

Accessor for all teams to return an array of teams

This needs to be done with no privacy leaks

toString

Returns String description of object

(Format as shown in Example Output)