first commit

This commit is contained in:
Boris
2024-01-15 20:14:10 +00:00
commit 8c81ee28b7
3106 changed files with 474415 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,56 @@
#BlueJ class context
comment0.params=
comment0.target=Game()
comment0.text=\n\ Default\ Constructor\ for\ "My\ First\ Game"\n
comment1.params=title\ objective\ costInPence\ gameManager
comment1.target=Game(java.lang.String,\ java.lang.String,\ int,\ Manager)
comment1.text=\n\ Old\ non-default\ constructor.\n\ public\ Game(\ String\ title,\ String\ objective,\ int\ costInPence\ )\n
comment10.params=newCostInPence
comment10.target=void\ setCostInPence(int)
comment10.text=\n\ Sets\ @costInPence\ to\ a\ user-input\ value.\n
comment11.params=newBestScore
comment11.target=void\ setBestScore(int)
comment11.text=\n\ Sets\ @bestScore\ to\ a\ user-input\ value\n
comment12.params=newBestScoreName
comment12.target=void\ setBestScoreName(java.lang.String)
comment12.text=\ \n\ Sets\ @bestScoreName\ to\ a\ user-input\ value.\n
comment13.params=newGameManager
comment13.target=void\ setGameManager(Manager)
comment13.text=\n\ Set\ @gameManager\ to\ a\ new\ gameManager\ object.\n
comment14.params=
comment14.target=void\ download()
comment14.text=\n\ Simulates\ a\ user\ downloading\ the\ game.\n
comment15.params=playerScore\ playerName
comment15.target=void\ checkScore(int,\ java.lang.String)
comment15.text=\n\ Checks\ to\ see\ if\ player's\ score\ is\ the\ highest.\ If\ so,\ replace\ highest\ score\ and\ name.\n
comment16.params=
comment16.target=void\ printReport()
comment16.text=\n\ Prints,\ to\ terminal,\ the\ fields\ and\ their\ values\ in\ a\ strict\ format.\n
comment17.params=
comment17.target=int\ calculateEarnings()
comment17.text=\n\ Return\ earnings\ by\ calculating\ @numberOfDownloads\ *\ @costInPence.\n
comment2.params=
comment2.target=java.lang.String\ getTitle()
comment2.text=\n\ Returns\ the\ @title\ value.\n
comment3.params=
comment3.target=java.lang.String\ getObjective()
comment3.text=\n\ Returns\ the\ @objective\ value.\n
comment4.params=
comment4.target=int\ getCostInPence()
comment4.text=\n\ Returns\ the\ @costInPence\ value.\n
comment5.params=
comment5.target=int\ getBestScore()
comment5.text=\n\ Returns\ the\ @bestScore\ value.\n
comment6.params=
comment6.target=java.lang.String\ getBestScoreName()
comment6.text=\n\ Returns\ the\ @bestScoreName\ value.\n
comment7.params=
comment7.target=Manager\ getManager()
comment7.text=\n\ Return\ the\ @gameManager\ value.\n
comment8.params=newTitle
comment8.target=void\ setTitle(java.lang.String)
comment8.text=\n\ Sets\ @title\ to\ a\ user-input\ value.\n
comment9.params=newObjective
comment9.target=void\ setObjective(java.lang.String)
comment9.text=\n\ Sets\ @objective\ to\ a\ user-input\ value.\n
numComments=18

View File

@@ -0,0 +1,250 @@
/**
* This class instanciates a mock "Game" and tracks downloads, high scores, etc.
*
* @author George Wilkinson
* @version 24/10/23
*/
public class Game
{
// Initialise title String to hold the title of the game.
private String title;
// Initialise objective String to hold the objective of the game.
private String objective;
// Initialise costInPence integer to hold the cost of the game.
private int costInPence;
// Initialise numberOfDownloads integer to hold the number of downloads the game has.
private int numberOfDownloads;
// Initialise bestScoreName String to hold the name of the highest score.
private String bestScoreName;
// Initialise bestScore integer to hold the best score game has.
private int bestScore;
// Initialise a gameManager object to hold the manager details assigned to the game.
private Manager gameManager;
/**
* Default Constructor for "My First Game"
*/
public Game()
{
// Initialise a default game
title = "My First Game";
objective = "To Play a Game";
costInPence = 100;
//Gives "My First Game" a default manager with the following fields.
gameManager = new Manager();
numberOfDownloads = 10;
bestScoreName = "George";
bestScore = 200;
}
/**
* Old non-default constructor.
* public Game( String title, String objective, int costInPence )
*/
public Game( String title, String objective, int costInPence, Manager gameManager )
{
// initialise instance variables
this.title = title;
this.objective = objective;
this.costInPence = costInPence;
this.gameManager = gameManager;
numberOfDownloads = 0;
bestScoreName = null;
bestScore = 0;
}
/**
*
* FIELD ACCESSOR START
*
*/
/**
* Returns the @title value.
*/
public String getTitle()
{
return title;
}
/**
* Returns the @objective value.
*/
public String getObjective()
{
return objective;
}
/**
* Returns the @costInPence value.
*/
public int getCostInPence()
{
return costInPence;
}
/**
* Returns the @bestScore value.
*/
public int getBestScore()
{
return bestScore;
}
/**
* Returns the @bestScoreName value.
**/
public String getBestScoreName()
{
return bestScoreName;
}
/**
* Return the @gameManager value.
*/
public Manager getManager()
{
return gameManager;
}
/**
*
* FIELD MUTATOR START
*
*/
/**
* Sets @title to a user-input value.
*/
public void setTitle( String newTitle )
{
title = newTitle;
}
/**
* Sets @objective to a user-input value.
*/
public void setObjective( String newObjective )
{
objective = newObjective;
}
/**
* Sets @costInPence to a user-input value.
*/
public void setCostInPence( int newCostInPence )
{
costInPence = newCostInPence;
}
/**
* Sets @bestScore to a user-input value
*/
public void setBestScore( int newBestScore )
{
bestScore = newBestScore;
}
/**
* Sets @bestScoreName to a user-input value.
*/
public void setBestScoreName( String newBestScoreName )
{
bestScoreName = newBestScoreName;
}
/**
* Set @gameManager to a new gameManager object.
*/
public void setGameManager( Manager newGameManager )
{
gameManager = newGameManager;
}
/**
*
* FUNCTIONAL MUTATOR START
*
*/
/**
* Simulates a user downloading the game.
*/
public void download()
{
System.out.println("Congratulations on your download! Please pay " + costInPence + " pence. Thank you");
//Increment number of downloads.
numberOfDownloads += 1;
}
/**
* Checks to see if player's score is the highest. If so, replace highest score and name.
*/
public void checkScore( int playerScore, String playerName )
{
if( playerScore > bestScore )
{
//Set new score, and player of said score to the "best" using the mutator methods made above.
setBestScore( playerScore );
setBestScoreName( playerName );
}
}
/**
* Prints, to terminal, the fields and their values in a strict format.
*/
public void printReport()
{
System.out.println( "Title: " + title );
System.out.println( "Objective: " + objective );
System.out.println( "Download cost: " + costInPence );
System.out.println( "Number of downloads to date: " + numberOfDownloads );
System.out.println( "Best score to date: " + bestScore );
System.out.println( "Player with best score: " + bestScoreName );
System.out.println( "Total earnings to date: " + calculateEarnings() );
System.out.println( "Game manager: " + gameManager.getSurname() );
}
/**
*
* FUNCTIONAL ACCESSOR START
*
*/
/**
* Return earnings by calculating @numberOfDownloads * @costInPence.
*/
public int calculateEarnings()
{
return ( numberOfDownloads * costInPence );
}
}

Binary file not shown.

View File

@@ -0,0 +1,20 @@
#BlueJ class context
comment0.params=
comment0.target=Manager()
comment0.text=\n\ Default\ constructor\ for\ objects\ of\ class\ Manager\n
comment1.params=surname\ managerID
comment1.target=Manager(java.lang.String,\ java.lang.String)
comment1.text=\n\ Constructor\ for\ objects\ of\ class\ Manager\n
comment2.params=
comment2.target=java.lang.String\ getSurname()
comment2.text=\n\ Returns\ the\ @surname\ value.\n
comment3.params=
comment3.target=java.lang.String\ getManagerID()
comment3.text=\n\ Returns\ the\ @managerID\ value.\n
comment4.params=newManagerID
comment4.target=void\ setManagerID(java.lang.String)
comment4.text=\n\ Sets\ @managerID\ to\ user\ input\ value\n
comment5.params=newSurname
comment5.target=void\ setSurname(java.lang.String)
comment5.text=\n\ Sets\ @surname\ to\ user\ input\ value\n
numComments=6

View File

@@ -0,0 +1,67 @@
/**
* This class instanciates a manager object for the mock Game.
*
* @author George Wilkinson
* @version 24/10/23
*/
public class Manager
{
// Initialise surname String to hold the value of the manager surname.
private String surname;
// Initialise managerID String to hold the value of the manager ID.
private String managerID;
/**
* Default constructor for objects of class Manager
*/
public Manager()
{
// Set field variables to pre-set values
surname = "Edwards";
managerID = "ManagerE1";
}
/**
* Constructor for objects of class Manager
*/
public Manager( String surname, String managerID )
{
// initialise instance variables with user values
this.surname = surname;
this.managerID = managerID;
}
/**
* Returns the @surname value.
*/
public String getSurname()
{
return surname;
}
/**
* Returns the @managerID value.
*/
public String getManagerID()
{
return managerID;
}
/**
* Sets @managerID to user input value
*/
public void setManagerID(String newManagerID)
{
managerID = newManagerID;
}
/**
* Sets @surname to user input value
*/
public void setSurname(String newSurname)
{
surname = newSurname;
}
}

View File

@@ -0,0 +1,12 @@
------------------------------------------------------------------------
This is the project README file. Here, you should describe your project.
Tell the reader (someone who does not know anything about this project)
all he/she needs to know. The comments should usually include at least:
------------------------------------------------------------------------
PROJECT TITLE:
PURPOSE OF PROJECT:
VERSION or DATE:
HOW TO START THIS PROJECT:
AUTHORS:
USER INSTRUCTIONS:

View File

@@ -0,0 +1,41 @@
#BlueJ package file
dependency1.from=Game
dependency1.to=Manager
dependency1.type=UsesDependency
objectbench.height=76
objectbench.width=940
package.editor.height=874
package.editor.width=814
package.editor.x=960
package.editor.y=31
package.numDependencies=1
package.numTargets=2
package.showExtends=true
package.showUses=true
project.charset=UTF-8
target1.editor.height=1049
target1.editor.width=960
target1.editor.x=1927
target1.editor.y=2191
target1.height=50
target1.name=Game
target1.naviview.expanded=true
target1.showInterface=false
target1.type=ClassTarget
target1.typeParameters=
target1.width=80
target1.x=110
target1.y=150
target2.editor.height=700
target2.editor.width=900
target2.editor.x=40
target2.editor.y=51
target2.height=50
target2.name=Manager
target2.naviview.expanded=true
target2.showInterface=false
target2.type=ClassTarget
target2.typeParameters=
target2.width=90
target2.x=220
target2.y=150