General Guidelines for Project Submission
Items to be submitted
1. A README file
2. Various Source Files (If certain classes, not found in the JAVA API or in the projects directory have been used during the project work, then those classes have to be submitted.)
3. Typescript of the project
4. Technical Manual
5. User Manual
Important Points to be noted
While submitting your project, take a special note of Program appearance, indentation, spacing and readability. The programs should be well documented and each method should be commented with a PRE and POST conditions. There should be a name box in each of your file, except the typescript that gives your name, file name, student id number and a brief description of the contents of the file.
README
A README file, details the various files submitted and highlights the purpose and need for each file.
Technical Manual
This is a report that is used by personnel who would take care of software maintenance and updation. The document should explain the technical aspect of the project carried out. The manual should throw light on the accessibility of the class, the methods, the nature of the methods (i.e., predicate or boolean, likewise). The Technical Manual should necessarily contain the class diagram of various classes inside the program file. The Technical manual should contain the following items:
1. Project Title
2. Project Description
3. Class Diagram
4. Algorithm employed for the various methods and the main program
5. Various Data Structures used
6. Test Data used
7. Limitations (if any)
8. Future expansions (if possible)
If the project has used any interface or inherited any class, then
the manual should clearly mention the nature or type of the interface or
the parent class and the reason why it was done.
User Manual
This manual is generally meant for the end-users of the software
and should be written in a layman point of view. The manual should give
details about, how to run the program, the expected output. In addition,
sample inputs and outputs should be provided.
Typescript
This records the session, in a file called typescript.
For obtaining the typescript of the test, go through the following steps.
// Name: John Doe
// Person Number: 1321-1421
// File: README
// Description: This file gives the list of files involved in the project work
This project work involves the Simulation of a Football game. The project maintains the scores of individual teams. It keeps the scores updated and displays the average points scored by each team at the end of every quarter.
Following are the list of files that comprise the project work:
Class file: ScoreBoard.java
// Name: John Doe
// Person Number: 1321-1421
// File: ScoreBoard.java
// contains method, which implement
various events in a football game.
private int score; // current score private int update; // keeps track of last update to Score String name; // Team name
// constructors
// default constructor
public ScoreBoard()
{
// POST: score and update are set to zero
score = 0;
update = 0;
}
// initializing constructor
public ScoreBoard (String teamName) {
// PRE: teamName is obtained as a parameter.
// POST: name is set to teamName. score and update are initilialized to zero. name = teamName; score = 0;
update = 0;
}
// service/interface methods
public void touchDown()
{
// POST: score and update are incremented by 6.
score = score + 6;
update = 6;
}
public void extraPoint()
{
// POST: score and update are added one point each.
score = score +1;
update = 1;
}
public void fieldGoal()
{
// POST: Both score and update are updated by 3 points.
score = score + 3;
update = 3;
}
public void twoPointConv ()
{
// POST: score and update are increased by two points.
score = score + 2;
update = 2;
}
public void safety()
{
// POST: score and update get incremented by 2.
score = score + 2;
update = 2;
}
public void undo()
{
// POST: score gets decremented by update.
score = score - update;
}
// utility methods public void average(int quartNum) {
// PRE: quartNum is obtained.
// POST: the average point of the team is computed and displayed. double avg = (double)score / (double)quartNum; System.out.print(this.getName()); System.out.print(" : "); Format.printr(2,avg);
System.out.println();
}
public void setName(String teamName)
{
// PRE: teamName is obtained.
// POST: name is assigned to teamName.
name = teamName;
}
public String getName()
{
// POST: name is returned to the calling method.
return name;
}
public int getScore()
{
// POST: score is returned to the calling method.
return score;
}
public void display()
{
// POST: name and score are printed.
System.out.println(name +" :" + score);
}
public void displayWinner(ScoreBoard team)
{
// PRE: Object team is obtained, to decide the winner.
// POST: name of the winning team is displayed.
System.out.println();
System.out.println("The winning team !!");
if (this.getScore() < team.getScore())
team.display();
else
this.display();
}
// predicate method
public boolean shutDown()
{
// POST: boolean is returned, depending upon score.
return (score == 0); // if score = 0 return TRUE else FALSE
}
}
Application: SuperBowl.java
// Name: John Doe
// Person Number: 1321-1421
// File: SuperBowl.java
// in ScoreBoard.java and calls
the methods, appropriate to the event, in the game.
class SuperBowl {
public static void main (String [] args) {
ScoreBoard Denver, GreenBay; // declaring object references
Denver = new ScoreBoard("BRONCOS"); // instantiating objects
GreenBay = new ScoreBoard();
GreenBay.setName("PACKERS");
// First Quarter
// invoking appropriate methods
GreenBay.touchDown();
GreenBay.extraPoint();
Denver.touchDown();
Denver.extraPoint();
Denver.twoPointConv();
GreenBay.safety();
Denver.average(1);
GreenBay.average(1);
// Second Quarter
Denver.touchDown();
Denver.extraPoint();
Denver.fieldGoal();
GreenBay.touchDown();
GreenBay.extraPoint();
Denver.undo();
Denver.average(2);
GreenBay.average(2);
// Third quarter
Denver.fieldGoal();
Denver.undo();
Denver.touchDown();
GreenBay.fieldGoal();
Denver.touchDown(); Denver.extraPoint(); Denver.safety(); Denver.average(3); GreenBay.average(3);
// Fourth quarter
GreenBay.touchDown();
Denver.safety();
GreenBay.extraPoint();
Denver.touchDown();
Denver.extraPoint();
Denver.average(4);
GreenBay.average(4);
Denver.displayWinner(GreenBay);
}
}
Technical Manual
// Name: John Doe
// Person Number: 1321-1421
// File: Technical Manual
// Description: This file gives insight to the data in the various classes and the methods, their access
// specifications and the nature of the methods. This manual talks in detail the various technical
// aspects covered in the project.
Project Title:
Simulation of a Foot Ball Game
Project Description:
The project aims to simulate a
football game, through a classfile and an application file. The classfile
(ScoreBoard.java) defines various methods, which help to update the score.
In addition to this it also has predicate and utility methods. The application
program keeps track of the goals scored and calls the appropriate methods,
when an event takes place.
ScoreBoard.java:
The class ScoreBoard.java uses the io package from the Java API. The class basically defines three data members, viz., score, update and name. The first two data members are defined as integers and have their access mechanism specified as private. The third data member, name is a String.
The class does not use the default constructor provided by the system, instead defines two constructors for its use. One of the constructors does not take any argument and initializes the two integer data members to zero. The second constructor takes a String as a parameter and initializes name to the String obtained as a parameter and the integers to zero. Since the program provides constructors, the class can be instantiated and so all the methods are Instance methods.
The class defines six service or interface methods and six utility methods. The service methods are
touchDown, extraPoint, fieldGoal, twoPointConv, safety and undo. average, setName, getName, getScore, display, displayWinner come under the category of utility methods. All of the service methods affect the score and update the two integer data fields. The service methods defined in the class neither take any argument as a parameter nor return any data type. The utility methods average, setName and displayWinner take an argument as a parameter and return a void. The rest of the utility methods getName, getScore, and display take in an argument as a parameter and return a void.
All the service methods help in changing the score and thereby keeping it updated. The method setName is used for setting the name of a team. The method average takes in an integer (the quarter number) and returns a void. Internally the method computes the average points for the team till that particular quarter and prints the average as a double quantity. For formatting this data, the printr method of Format class is utilized. The printr method is a Class method and basically takes two arguments. The first parameter being an integer denotes the precision required and the second parameter, is a double quantity, which has to be formatted to the desired precision. The method displayWinner takes an object of ScoreBoard class as a parameter and internally prints out the name of the team, which has scored the maximum points, through the use of the getScore () method. The getScore method of the team calling the displayWinner method is accessed, using ?this?.
The methods getName and getScore are respectively used for accessing the name of the team and the score of a team respectively. Each respectively return a String and an integer. The display method prints the name of a team along with its score.
The only predicate method (methods that return a boolean) in the class is the shutDown, which tells whether a shut down has occurred or not. If the score is zero, then the method return a TRUE else returns a FALSE.
SuperBowl.java:
The class SuperBowl uses the classes from the io package of the Java API. This is the application program of the project and hence defines the method main.
In the method main two objects
of ScoreBoard class are instantiated. Then the two objects as per the scoring
events in the game call the various service methods of ScoreBoard. At the
end of every quarter, the method average is called is called to display
the average point scored by the teams and finally the method displayWinner
is called to print out the name of the winning team.
Class Diagram:
public class ScoreBoard
// Data declarations
private int score;
private int update;
String name;
// Constructors
public ScoreBoard();
public ScoreBoard(String teamName):
// Service or Interface methods
public void touchDown();
public void extraPoint();
public void fieldGoal();
public void twoPointConv();
public void safety();
public void undo();
public void setName(String teamName)
public int getName();
public int getScore();
public void display();
public void displayWinner();
Both the application program and the class program do not involve any complex logic, but simple manipulation of the data members of the class and the display of various information. The only data types involved in this project are String and the primitive data type int. (For a typical project you will need to add (here) Algorithms and Data Structures used.
User Manual
// Name: John Doe
// Person Number: 1321-1421
// File: User Manual
// Description: This file provides instruction to the end user, about the usage of the software.
Thank You for buying SimX. You are now the proud owner of this software, which simulates a football game. Now sit back and relax and watch your favorite game get simulated.
To run the simulation, at the command prompt type javac SuperBowl.java, followed by java SuperBowl. Once the simulation starts, the average points scored by each team are displayed at the end of each quarter. A sample output is provided below.
BRONCOS : 9.00
PACKERS : 9.00
BRONCOS : 8.00
PACKERS : 8.00
BRONCOS : 10.33
PACKERS : 6.33
BRONCOS : 10.00
PACKERS : 6.50
The winning team !!
BRONCOS : 40
The precision of the average points can be adjusted by changing the first parameter to the printr method of the Format class, which is called internally in the average method. The default precision is 2.
Typescript
Script started on Mon Feb 08 21:35:44 1999everest {~/work} > javac SuperBowl.javaeverest {~/work} > java SuperBowlBRONCOS : 9.00PACKERS : 9.00BRONCOS : 8.00PACKERS : 8.00BRONCOS : 10.33PACKERS : 6.33BRONCOS : 10.00PACKERS : 6.50
The winning team !!
BRONCOS :40
everest {~/work} > exitexit
script done on Mon Feb 08 21:36:03 1999