SlideShare a Scribd company logo
I really need some help if I have this right so far. ***Please Resubmit the revsised and updated
Code with Comments added explaining please. RIGHT***** JAVA
Here are the instructions and then the code in a sec.
Part II. Java Application: Use the code you submitted in Project One Milestone to continue
developing the game application in this project. Be sure to correct errors and incorporate
feedback before submitting Project One.
Please note: The starter code for this project was provided in the Project One Milestone. If you
have not completed the Project One Milestone, you will not be penalized in this assignment, but
you will have additional steps to complete to ensure you meet all the components of Project One.
Review the class files provided and complete the following tasks to create a functional game
application that meets your clients requirements. You will submit the completed game
application code for review.
Begin by reviewing the base Entity class. It contains the attributes id and name, implying that all
entities in the application will have an identifier and name.
Software Design Patterns: Review the GameService class. Notice the static variables holding the
next identifier to be assigned for game id, team id, and player id.
Referring back to Project One Milestone, be sure that you use the singleton pattern to adapt an
ordinary class, so only one instance of the GameService class can exist in memory at any given
time. This can be accomplished by creating unique identifiers for each instance of a game, team,
or player.
Your client has requested that the game and team names be unique to allow users to check
whether a name is in use when choosing a team name. Referring back to the Project One
Milestone, be sure that you use the iterator pattern to complete the addGame() and getGame()
methods.
Create a base class called Entity. The Entity class must hold the common attributes and
behaviors (as shown in the UML diagram provided in the Supporting Materials section below).
Refactor the Game class to inherit from this new Entity class.
Complete the code for the Player and Team classes. Each class must derive from the Entity class,
as demonstrated in the UML diagram.
Every team and player must have a unique name by searching for the supplied name prior to
adding the new instance. Use the iterator pattern in the addTeam() and addPlayer() methods.
Functionality and Best Practices
Once you are finished coding, use the main() method provided in the ProgramDriver class to run
and test the game application to ensure it is functioning properly.
Be sure your code demonstrates industry standard best practices to enhance the readability of
your code, including appropriate naming conventions and in-line comments that describe the
functionality.
Here is my answer that I need a little improvement on its code since I am having trouble making
it right.
Here I am attaching code for these Files:
Entity.java
Game.java
Team.java
Player.java
GameService.java
ProgramDriver.java
SingletonTester.java
Source Code for Entity.java
package com.gamingroom;
public class Entity {
long id;
String name;
/*
* the default constructor
*/
public Entity() {
}
/*
* Constructor with a identifier and name
*/
public Entity (long id, String name) {
this.id = id;
this.name = name;
}
/*
* @return id
*/
public long getId() {
return this.id;
}
/*
* @return name
*/
public String getName() {
return this.name;
}
@Override
public String toString() {
return "Entity [id=" + id + ", name=" + name + "]";
}
}
Source code for Game.java:
package com.gamingroom;
import java.util.ArrayList;
import java.util.List;
/**
* A simple class to hold information about a game
*
*
* Notice the overloaded constructor that requires
* an id and name to be passed when creating.
* Also note that no mutators (setters) defined so
* these values cannot be changed once a game is
* created.
*
*
* @author coce@snhu.edu
*
*/
public class Game extends Entity {
/**
* Hide the default constructor to prevent creating empty instances.
*/
private static List teams = new ArrayList();
/**
* Constructor with an identifier and name
*/
public Game(long id, String name) {
this.id = id;
this.name = name;
}
public Team addTeam(String name) {
// a local team instance
Team team = null;
//search through the teams if the name exist return it.
for(int i = 0; i < teams.size(); ++i) {
if (name.equalsIgnoreCase(teams.get(i).getName())) {
team = teams.get(i);
}
}
// if not found, make a new team insatnce and add to list of teams
if (team == null) {
team = new Team((long) teams.size(), name);
teams.add(team);
}
return team;
}
@Override
public String toString() {
return "Game [id=" + id + ", name=" + name + "]";
}
}
Source Code for Team.Java
package com.gamingroom;
import java.util.ArrayList;
import java.util.List;
/**
* A simple class to hold information about a team
*
* Notice the overloaded constructor that requires
* an id and name to be passed when creating.
* Also note that no mutators (setters) defined so
* these values cannot be changed once a team is
* created.
*
* @author coce@snhu.edu
*
*/
public class Team extends Entity {
private static List players = new ArrayList();
/*
* Constructor with an identifier and name
*/
public Team(long id, String name) {
this.id = id;
this.name = name;
}
public Player addPlayer (String name) {
//a local team insatnce
Player player = null;
//search through the teams if the name name exist return it.
for (int i = 0; i < players.size(); ++i) {
if (name.equalsIgnoreCase(players.get(i).getName())) {
player = players.get(i);
}
}
// if not found, make a new team instance and add to list of teams
if (player == null) {
player = new Player((long) players.size(), name);
players.add(player);
}
//return the name existing team instance to the caller.
return player;
}
//@override
public String toString() {
return "Entity [id=" + id + ", name=" + name + "]";
}
}
Source code for Player.java:
package com.gamingroom;
/**
* A simple class to hold information about a player
*
* Notice the overloaded constructor that requires
* an id and name to be passed when creating.
* Also note that no mutators (setters) defined so
* these values cannot be changed once a player is
* created.
*
* @author coce@snhu.edu
*
*/
public class Player extends Entity {
long id;
String name;
/*
* Constructor with an identifier and name
*/
public Player(long id, String name) {
this.id = id;
this.name = name;
}
@Override
public String toString() {
return "Player [id=" + id + ", name=" + name + "]";
}
}
Source code for GameService.java:
package com.gamingroom;
import java.util.ArrayList;
import java.util.List;
/**
* A singleton service for the game engine
*
* @author Bryan Molina******
*/
public class GameService {
/**
* A list of the active games
*/
private static List games = new ArrayList();
/*
* Holds the next game identifier
*/
private static long nextGameId = 1;
private static long nextTeamId = 1;
private static long nextPlayerId = 1;
// Creating a local instance of this class. Since our constructor is private,
// we know that we will only have this one instance of this object making it a singleton.
private static GameService service = new GameService();
// it is normal for a singleton to have a private constructor so that we don't make additional
instances outside the class.
private GameService() {
}
//Public accessor for our instance will allow outside classes to access objects in this Singleton
Class
public static GameService getInstance() {
return service;
}
//This is the new line for the assignment ** Bryan Molina
/**
* Construct a new game instance
*
* @param name the unique name of the game
* @return the game instance (new or existing)
*/
public Game addGame(String name) {
// a local game instance
Game game = null;
for(int i = 0; i < getGameCount(); ++i ) {
if (name.equalsIgnoreCase(games.get(i).getName())) {
game = games.get(i);
}
}
if (game == null) {
game = new Game(nextGameId++, name);
games.add(game);
}
return game;
}
Game getGame(int index) {
return games.get(index);
}
/**
* Returns the game instance with the specified id.
*
* @param id unique identifier of game to search for
* @return requested game instance
*/
public Game getGame(long id) {
// a local game instance
Game game = null;
// FIXME: Use iterator to look for existing game with same id
// if found, simply assign that instance to the local variable
for (int i = 0; i < getGameCount(); ++i) {
if (games.get(i).getId() == id) {
game = games.get(i);
}
}
return game;
}
/**
* Returns the game instance with the specified name.
*
* @param name unique name of game to search for
* @return requested game instance
*/
public Game getGame(String name) {
// a local game instance
Game game = null;
// FIXME: Use iterator to look for existing game with same name
// if found, simply assign that instance to the local variable
for(int i = 0; i< getGameCount(); ++i ) {
if(name.equalsIgnoreCase(games.get(i).getName())) {
game = games.get(i);
}
}
return game;
}
/**
* Returns the number of games currently active
*
* @return the number of games currently active
*/
public int getGameCount() {
return games.size();
}
public long getNextPlayerId() {
return nextPlayerId++;
}
public long getNextTeamId() {
return nextTeamId++;
}
}
Source code for ProgramDriver.java:
package com.gamingroom;
/**
* Application start-up program
*
* @author Bryan Molina ***
*/
public class ProgramDriver {
/**
* The one-and-only main() method
*
* @param args command line arguments
*/
public static void main(String[] args) {
// FIXME: obtain reference to the singleton instance
GameService service = GameService.getInstance();
System.out.println("nAbout to test initializing game data...");
// initialize with some game data
Game game1 = service.addGame("Game #1");
System.out.println(game1);
Game game2 = service.addGame("Game #2");
System.out.println(game2);
// use another class to prove there is only one instance
SingletonTester tester = new SingletonTester();
tester.testSingleton();
}
}
Source code for SingletonTester.java:
package com.gamingroom;
/**
* A class to test a singleton's behavior
*
* @author Bryan Molina *****
*/
public class SingletonTester {
public void testSingleton() {
System.out.println("nAbout to test the singleton...");
// FIXME: obtain local reference to the singleton instance
GameService service = GameService.getInstance();
// a simple for loop to print the games
for (int i = 0; i < service.getGameCount(); i++) {
System.out.println(service.getGame(i));
}
}
}
ProgramDriver (1) [Java Application] CiProgram FilesJavaljdk-19 binljavaw.exe (Mar 18,
2023, 9:32:50 PM - 9:32:52 PM) [pid: 44352] About to test initializing game data... Game [id=1,
name=Game #1] Game [ id =2, name = Game #2] About to test the singleton... Game [ id =1,
name=Game #1] Game [ id =2, name = Game #2]

More Related Content

Similar to I really need some help if I have this right so far. Please Resub.pdf

Write a class (BasketballTeam) encapsulating the concept of a tea.pdf
Write a class (BasketballTeam) encapsulating the concept of a tea.pdfWrite a class (BasketballTeam) encapsulating the concept of a tea.pdf
Write a class (BasketballTeam) encapsulating the concept of a tea.pdf
rozakashif85
 
Use Netbeans to copy your last lab (Lab 07) to a new project called La.pdf
Use Netbeans to copy your last lab (Lab 07) to a new project called La.pdfUse Netbeans to copy your last lab (Lab 07) to a new project called La.pdf
Use Netbeans to copy your last lab (Lab 07) to a new project called La.pdf
ashishgargjaipuri
 
Suggestion- Use Netbeans to copy your last lab (Lab 07) to a new proje.pdf
Suggestion- Use Netbeans to copy your last lab (Lab 07) to a new proje.pdfSuggestion- Use Netbeans to copy your last lab (Lab 07) to a new proje.pdf
Suggestion- Use Netbeans to copy your last lab (Lab 07) to a new proje.pdf
ssuser58be4b1
 
We will be making 4 classes Main - for testing the code Hi.pdf
 We will be making 4 classes Main - for testing the code Hi.pdf We will be making 4 classes Main - for testing the code Hi.pdf
We will be making 4 classes Main - for testing the code Hi.pdf
anithareadymade
 
Games, AI, and Research - Part 2 Training (FightingICE AI Programming)
Games, AI, and Research - Part 2 Training (FightingICE AI Programming)Games, AI, and Research - Part 2 Training (FightingICE AI Programming)
Games, AI, and Research - Part 2 Training (FightingICE AI Programming)
Pujana Paliyawan
 
Creating a Facebook Clone - Part XXXI - Transcript.pdf
Creating a Facebook Clone - Part XXXI - Transcript.pdfCreating a Facebook Clone - Part XXXI - Transcript.pdf
Creating a Facebook Clone - Part XXXI - Transcript.pdf
ShaiAlmog1
 
Annotation processor and compiler plugin
Annotation processor and compiler pluginAnnotation processor and compiler plugin
Annotation processor and compiler plugin
Oleksandr Radchykov
 
Question IYou are going to use the semaphores for process sy.docx
Question IYou are going to use the semaphores for process sy.docxQuestion IYou are going to use the semaphores for process sy.docx
Question IYou are going to use the semaphores for process sy.docx
audeleypearl
 
Creating a Whatsapp Clone - Part XI - Transcript.pdf
Creating a Whatsapp Clone - Part XI - Transcript.pdfCreating a Whatsapp Clone - Part XI - Transcript.pdf
Creating a Whatsapp Clone - Part XI - Transcript.pdf
ShaiAlmog1
 
question.(player, entity ,field and base.java codes are given)Stop.pdf
question.(player, entity ,field and base.java codes are given)Stop.pdfquestion.(player, entity ,field and base.java codes are given)Stop.pdf
question.(player, entity ,field and base.java codes are given)Stop.pdf
shahidqamar17
 
IntroToEngineDevelopment.pdf
IntroToEngineDevelopment.pdfIntroToEngineDevelopment.pdf
IntroToEngineDevelopment.pdf
zakest1
 
Angular 2 introduction
Angular 2 introductionAngular 2 introduction
Angular 2 introduction
Christoffer Noring
 
Java căn bản - Chapter4
Java căn bản - Chapter4Java căn bản - Chapter4
Java căn bản - Chapter4
Vince Vo
 
Chapter 4 - Defining Your Own Classes - Part I
Chapter 4 - Defining Your Own Classes - Part IChapter 4 - Defining Your Own Classes - Part I
Chapter 4 - Defining Your Own Classes - Part I
Eduardo Bergavera
 
import java.util.ArrayList; import java.util.Iterator; A.pdf
import java.util.ArrayList; import java.util.Iterator;   A.pdfimport java.util.ArrayList; import java.util.Iterator;   A.pdf
import java.util.ArrayList; import java.util.Iterator; A.pdf
anushafashions
 
2. Create a Java class called EmployeeMain within the same project Pr.docx
 2. Create a Java class called EmployeeMain within the same project Pr.docx 2. Create a Java class called EmployeeMain within the same project Pr.docx
2. Create a Java class called EmployeeMain within the same project Pr.docx
ajoy21
 
Commenting in Agile Development
Commenting in Agile DevelopmentCommenting in Agile Development
Commenting in Agile Development
Jan Rybák Benetka
 
C#i need help creating the instance of stream reader to read from .pdf
C#i need help creating the instance of stream reader to read from .pdfC#i need help creating the instance of stream reader to read from .pdf
C#i need help creating the instance of stream reader to read from .pdf
ajantha11
 
CIS355A_StudentName_CourseProjectCIS355A Week 7 Course Project..docx
CIS355A_StudentName_CourseProjectCIS355A Week 7 Course Project..docxCIS355A_StudentName_CourseProjectCIS355A Week 7 Course Project..docx
CIS355A_StudentName_CourseProjectCIS355A Week 7 Course Project..docx
clarebernice
 
classes & objects in cpp overview
classes & objects in cpp overviewclasses & objects in cpp overview
classes & objects in cpp overview
gourav kottawar
 

Similar to I really need some help if I have this right so far. Please Resub.pdf (20)

Write a class (BasketballTeam) encapsulating the concept of a tea.pdf
Write a class (BasketballTeam) encapsulating the concept of a tea.pdfWrite a class (BasketballTeam) encapsulating the concept of a tea.pdf
Write a class (BasketballTeam) encapsulating the concept of a tea.pdf
 
Use Netbeans to copy your last lab (Lab 07) to a new project called La.pdf
Use Netbeans to copy your last lab (Lab 07) to a new project called La.pdfUse Netbeans to copy your last lab (Lab 07) to a new project called La.pdf
Use Netbeans to copy your last lab (Lab 07) to a new project called La.pdf
 
Suggestion- Use Netbeans to copy your last lab (Lab 07) to a new proje.pdf
Suggestion- Use Netbeans to copy your last lab (Lab 07) to a new proje.pdfSuggestion- Use Netbeans to copy your last lab (Lab 07) to a new proje.pdf
Suggestion- Use Netbeans to copy your last lab (Lab 07) to a new proje.pdf
 
We will be making 4 classes Main - for testing the code Hi.pdf
 We will be making 4 classes Main - for testing the code Hi.pdf We will be making 4 classes Main - for testing the code Hi.pdf
We will be making 4 classes Main - for testing the code Hi.pdf
 
Games, AI, and Research - Part 2 Training (FightingICE AI Programming)
Games, AI, and Research - Part 2 Training (FightingICE AI Programming)Games, AI, and Research - Part 2 Training (FightingICE AI Programming)
Games, AI, and Research - Part 2 Training (FightingICE AI Programming)
 
Creating a Facebook Clone - Part XXXI - Transcript.pdf
Creating a Facebook Clone - Part XXXI - Transcript.pdfCreating a Facebook Clone - Part XXXI - Transcript.pdf
Creating a Facebook Clone - Part XXXI - Transcript.pdf
 
Annotation processor and compiler plugin
Annotation processor and compiler pluginAnnotation processor and compiler plugin
Annotation processor and compiler plugin
 
Question IYou are going to use the semaphores for process sy.docx
Question IYou are going to use the semaphores for process sy.docxQuestion IYou are going to use the semaphores for process sy.docx
Question IYou are going to use the semaphores for process sy.docx
 
Creating a Whatsapp Clone - Part XI - Transcript.pdf
Creating a Whatsapp Clone - Part XI - Transcript.pdfCreating a Whatsapp Clone - Part XI - Transcript.pdf
Creating a Whatsapp Clone - Part XI - Transcript.pdf
 
question.(player, entity ,field and base.java codes are given)Stop.pdf
question.(player, entity ,field and base.java codes are given)Stop.pdfquestion.(player, entity ,field and base.java codes are given)Stop.pdf
question.(player, entity ,field and base.java codes are given)Stop.pdf
 
IntroToEngineDevelopment.pdf
IntroToEngineDevelopment.pdfIntroToEngineDevelopment.pdf
IntroToEngineDevelopment.pdf
 
Angular 2 introduction
Angular 2 introductionAngular 2 introduction
Angular 2 introduction
 
Java căn bản - Chapter4
Java căn bản - Chapter4Java căn bản - Chapter4
Java căn bản - Chapter4
 
Chapter 4 - Defining Your Own Classes - Part I
Chapter 4 - Defining Your Own Classes - Part IChapter 4 - Defining Your Own Classes - Part I
Chapter 4 - Defining Your Own Classes - Part I
 
import java.util.ArrayList; import java.util.Iterator; A.pdf
import java.util.ArrayList; import java.util.Iterator;   A.pdfimport java.util.ArrayList; import java.util.Iterator;   A.pdf
import java.util.ArrayList; import java.util.Iterator; A.pdf
 
2. Create a Java class called EmployeeMain within the same project Pr.docx
 2. Create a Java class called EmployeeMain within the same project Pr.docx 2. Create a Java class called EmployeeMain within the same project Pr.docx
2. Create a Java class called EmployeeMain within the same project Pr.docx
 
Commenting in Agile Development
Commenting in Agile DevelopmentCommenting in Agile Development
Commenting in Agile Development
 
C#i need help creating the instance of stream reader to read from .pdf
C#i need help creating the instance of stream reader to read from .pdfC#i need help creating the instance of stream reader to read from .pdf
C#i need help creating the instance of stream reader to read from .pdf
 
CIS355A_StudentName_CourseProjectCIS355A Week 7 Course Project..docx
CIS355A_StudentName_CourseProjectCIS355A Week 7 Course Project..docxCIS355A_StudentName_CourseProjectCIS355A Week 7 Course Project..docx
CIS355A_StudentName_CourseProjectCIS355A Week 7 Course Project..docx
 
classes & objects in cpp overview
classes & objects in cpp overviewclasses & objects in cpp overview
classes & objects in cpp overview
 

More from aggarwalshoppe14

I am sure you have heard the adage �my word is my bond�. We do not k.pdf
I am sure you have heard the adage �my word is my bond�. We do not k.pdfI am sure you have heard the adage �my word is my bond�. We do not k.pdf
I am sure you have heard the adage �my word is my bond�. We do not k.pdf
aggarwalshoppe14
 
I receive this answer for one of my questions, I need the reference .pdf
I receive this answer for one of my questions, I need the reference .pdfI receive this answer for one of my questions, I need the reference .pdf
I receive this answer for one of my questions, I need the reference .pdf
aggarwalshoppe14
 
I really need some help if I have this right so far. PLEASE CHANG.pdf
I really need some help if I have this right so far. PLEASE CHANG.pdfI really need some help if I have this right so far. PLEASE CHANG.pdf
I really need some help if I have this right so far. PLEASE CHANG.pdf
aggarwalshoppe14
 
I need this code, to show ALL inventory items, then with the remove .pdf
I need this code, to show ALL inventory items, then with the remove .pdfI need this code, to show ALL inventory items, then with the remove .pdf
I need this code, to show ALL inventory items, then with the remove .pdf
aggarwalshoppe14
 
I need help with the last 2 methods only in Huffman.java file the me.pdf
I need help with the last 2 methods only in Huffman.java file the me.pdfI need help with the last 2 methods only in Huffman.java file the me.pdf
I need help with the last 2 methods only in Huffman.java file the me.pdf
aggarwalshoppe14
 
I need help creating this flutter applicationPlease provide a com.pdf
I need help creating this flutter applicationPlease provide a com.pdfI need help creating this flutter applicationPlease provide a com.pdf
I need help creating this flutter applicationPlease provide a com.pdf
aggarwalshoppe14
 
His Majesty�s Government report that 20 of officials arrive late fo.pdf
His Majesty�s Government report that 20 of officials arrive late fo.pdfHis Majesty�s Government report that 20 of officials arrive late fo.pdf
His Majesty�s Government report that 20 of officials arrive late fo.pdf
aggarwalshoppe14
 
HIVin RNA genomu, bir RNA ablonundan bir DNA genomunu sentezlemek i.pdf
HIVin RNA genomu, bir RNA ablonundan bir DNA genomunu sentezlemek i.pdfHIVin RNA genomu, bir RNA ablonundan bir DNA genomunu sentezlemek i.pdf
HIVin RNA genomu, bir RNA ablonundan bir DNA genomunu sentezlemek i.pdf
aggarwalshoppe14
 
Hile ��geni bileenlerini a�klar. Tannm bir kriminolog olan Donald .pdf
Hile ��geni bileenlerini a�klar. Tannm bir kriminolog olan Donald .pdfHile ��geni bileenlerini a�klar. Tannm bir kriminolog olan Donald .pdf
Hile ��geni bileenlerini a�klar. Tannm bir kriminolog olan Donald .pdf
aggarwalshoppe14
 
Hi, I need help with this Probability question. Please show work and.pdf
Hi, I need help with this Probability question. Please show work and.pdfHi, I need help with this Probability question. Please show work and.pdf
Hi, I need help with this Probability question. Please show work and.pdf
aggarwalshoppe14
 
Hi could I get the java code for all the tasks pls, many thanks!.pdf
Hi could I get the java code for all the tasks pls, many thanks!.pdfHi could I get the java code for all the tasks pls, many thanks!.pdf
Hi could I get the java code for all the tasks pls, many thanks!.pdf
aggarwalshoppe14
 
HHI analysis indicates that many states have a highly concentrated i.pdf
HHI analysis indicates that many states have a highly concentrated i.pdfHHI analysis indicates that many states have a highly concentrated i.pdf
HHI analysis indicates that many states have a highly concentrated i.pdf
aggarwalshoppe14
 
Hello I need help configuring the regression equation for this scatt.pdf
Hello I need help configuring the regression equation for this scatt.pdfHello I need help configuring the regression equation for this scatt.pdf
Hello I need help configuring the regression equation for this scatt.pdf
aggarwalshoppe14
 
Health Economics with Taxation and Agrarian ReformActivity 2 Grap.pdf
Health Economics with Taxation and Agrarian ReformActivity 2 Grap.pdfHealth Economics with Taxation and Agrarian ReformActivity 2 Grap.pdf
Health Economics with Taxation and Agrarian ReformActivity 2 Grap.pdf
aggarwalshoppe14
 
Here is app.js, artist.js and songs.js file. Can you look at the my .pdf
Here is app.js, artist.js and songs.js file. Can you look at the my .pdfHere is app.js, artist.js and songs.js file. Can you look at the my .pdf
Here is app.js, artist.js and songs.js file. Can you look at the my .pdf
aggarwalshoppe14
 
Here is a short amino acid sequence mapped as polar (P) and nonpolar.pdf
Here is a short amino acid sequence mapped as polar (P) and nonpolar.pdfHere is a short amino acid sequence mapped as polar (P) and nonpolar.pdf
Here is a short amino acid sequence mapped as polar (P) and nonpolar.pdf
aggarwalshoppe14
 
help write program Project Desoription The purpose of thi project i.pdf
help write program Project Desoription The purpose of thi project i.pdfhelp write program Project Desoription The purpose of thi project i.pdf
help write program Project Desoription The purpose of thi project i.pdf
aggarwalshoppe14
 
I need a case analysis using Harvards Business School format please.pdf
I need a case analysis using Harvards Business School format please.pdfI need a case analysis using Harvards Business School format please.pdf
I need a case analysis using Harvards Business School format please.pdf
aggarwalshoppe14
 
Household size and educational status are part of ���� Psychologic.pdf
Household size and educational status are part of ���� Psychologic.pdfHousehold size and educational status are part of ���� Psychologic.pdf
Household size and educational status are part of ���� Psychologic.pdf
aggarwalshoppe14
 
I issued 2000 shares for my society in capsim core how much will be .pdf
I issued 2000 shares for my society in capsim core how much will be .pdfI issued 2000 shares for my society in capsim core how much will be .pdf
I issued 2000 shares for my society in capsim core how much will be .pdf
aggarwalshoppe14
 

More from aggarwalshoppe14 (20)

I am sure you have heard the adage �my word is my bond�. We do not k.pdf
I am sure you have heard the adage �my word is my bond�. We do not k.pdfI am sure you have heard the adage �my word is my bond�. We do not k.pdf
I am sure you have heard the adage �my word is my bond�. We do not k.pdf
 
I receive this answer for one of my questions, I need the reference .pdf
I receive this answer for one of my questions, I need the reference .pdfI receive this answer for one of my questions, I need the reference .pdf
I receive this answer for one of my questions, I need the reference .pdf
 
I really need some help if I have this right so far. PLEASE CHANG.pdf
I really need some help if I have this right so far. PLEASE CHANG.pdfI really need some help if I have this right so far. PLEASE CHANG.pdf
I really need some help if I have this right so far. PLEASE CHANG.pdf
 
I need this code, to show ALL inventory items, then with the remove .pdf
I need this code, to show ALL inventory items, then with the remove .pdfI need this code, to show ALL inventory items, then with the remove .pdf
I need this code, to show ALL inventory items, then with the remove .pdf
 
I need help with the last 2 methods only in Huffman.java file the me.pdf
I need help with the last 2 methods only in Huffman.java file the me.pdfI need help with the last 2 methods only in Huffman.java file the me.pdf
I need help with the last 2 methods only in Huffman.java file the me.pdf
 
I need help creating this flutter applicationPlease provide a com.pdf
I need help creating this flutter applicationPlease provide a com.pdfI need help creating this flutter applicationPlease provide a com.pdf
I need help creating this flutter applicationPlease provide a com.pdf
 
His Majesty�s Government report that 20 of officials arrive late fo.pdf
His Majesty�s Government report that 20 of officials arrive late fo.pdfHis Majesty�s Government report that 20 of officials arrive late fo.pdf
His Majesty�s Government report that 20 of officials arrive late fo.pdf
 
HIVin RNA genomu, bir RNA ablonundan bir DNA genomunu sentezlemek i.pdf
HIVin RNA genomu, bir RNA ablonundan bir DNA genomunu sentezlemek i.pdfHIVin RNA genomu, bir RNA ablonundan bir DNA genomunu sentezlemek i.pdf
HIVin RNA genomu, bir RNA ablonundan bir DNA genomunu sentezlemek i.pdf
 
Hile ��geni bileenlerini a�klar. Tannm bir kriminolog olan Donald .pdf
Hile ��geni bileenlerini a�klar. Tannm bir kriminolog olan Donald .pdfHile ��geni bileenlerini a�klar. Tannm bir kriminolog olan Donald .pdf
Hile ��geni bileenlerini a�klar. Tannm bir kriminolog olan Donald .pdf
 
Hi, I need help with this Probability question. Please show work and.pdf
Hi, I need help with this Probability question. Please show work and.pdfHi, I need help with this Probability question. Please show work and.pdf
Hi, I need help with this Probability question. Please show work and.pdf
 
Hi could I get the java code for all the tasks pls, many thanks!.pdf
Hi could I get the java code for all the tasks pls, many thanks!.pdfHi could I get the java code for all the tasks pls, many thanks!.pdf
Hi could I get the java code for all the tasks pls, many thanks!.pdf
 
HHI analysis indicates that many states have a highly concentrated i.pdf
HHI analysis indicates that many states have a highly concentrated i.pdfHHI analysis indicates that many states have a highly concentrated i.pdf
HHI analysis indicates that many states have a highly concentrated i.pdf
 
Hello I need help configuring the regression equation for this scatt.pdf
Hello I need help configuring the regression equation for this scatt.pdfHello I need help configuring the regression equation for this scatt.pdf
Hello I need help configuring the regression equation for this scatt.pdf
 
Health Economics with Taxation and Agrarian ReformActivity 2 Grap.pdf
Health Economics with Taxation and Agrarian ReformActivity 2 Grap.pdfHealth Economics with Taxation and Agrarian ReformActivity 2 Grap.pdf
Health Economics with Taxation and Agrarian ReformActivity 2 Grap.pdf
 
Here is app.js, artist.js and songs.js file. Can you look at the my .pdf
Here is app.js, artist.js and songs.js file. Can you look at the my .pdfHere is app.js, artist.js and songs.js file. Can you look at the my .pdf
Here is app.js, artist.js and songs.js file. Can you look at the my .pdf
 
Here is a short amino acid sequence mapped as polar (P) and nonpolar.pdf
Here is a short amino acid sequence mapped as polar (P) and nonpolar.pdfHere is a short amino acid sequence mapped as polar (P) and nonpolar.pdf
Here is a short amino acid sequence mapped as polar (P) and nonpolar.pdf
 
help write program Project Desoription The purpose of thi project i.pdf
help write program Project Desoription The purpose of thi project i.pdfhelp write program Project Desoription The purpose of thi project i.pdf
help write program Project Desoription The purpose of thi project i.pdf
 
I need a case analysis using Harvards Business School format please.pdf
I need a case analysis using Harvards Business School format please.pdfI need a case analysis using Harvards Business School format please.pdf
I need a case analysis using Harvards Business School format please.pdf
 
Household size and educational status are part of ���� Psychologic.pdf
Household size and educational status are part of ���� Psychologic.pdfHousehold size and educational status are part of ���� Psychologic.pdf
Household size and educational status are part of ���� Psychologic.pdf
 
I issued 2000 shares for my society in capsim core how much will be .pdf
I issued 2000 shares for my society in capsim core how much will be .pdfI issued 2000 shares for my society in capsim core how much will be .pdf
I issued 2000 shares for my society in capsim core how much will be .pdf
 

Recently uploaded

A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
RAHUL
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
NgcHiNguyn25
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
IreneSebastianRueco1
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
paigestewart1632
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 

Recently uploaded (20)

A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 

I really need some help if I have this right so far. Please Resub.pdf

  • 1. I really need some help if I have this right so far. ***Please Resubmit the revsised and updated Code with Comments added explaining please. RIGHT***** JAVA Here are the instructions and then the code in a sec. Part II. Java Application: Use the code you submitted in Project One Milestone to continue developing the game application in this project. Be sure to correct errors and incorporate feedback before submitting Project One. Please note: The starter code for this project was provided in the Project One Milestone. If you have not completed the Project One Milestone, you will not be penalized in this assignment, but you will have additional steps to complete to ensure you meet all the components of Project One. Review the class files provided and complete the following tasks to create a functional game application that meets your clients requirements. You will submit the completed game application code for review. Begin by reviewing the base Entity class. It contains the attributes id and name, implying that all entities in the application will have an identifier and name. Software Design Patterns: Review the GameService class. Notice the static variables holding the next identifier to be assigned for game id, team id, and player id. Referring back to Project One Milestone, be sure that you use the singleton pattern to adapt an ordinary class, so only one instance of the GameService class can exist in memory at any given time. This can be accomplished by creating unique identifiers for each instance of a game, team, or player. Your client has requested that the game and team names be unique to allow users to check whether a name is in use when choosing a team name. Referring back to the Project One Milestone, be sure that you use the iterator pattern to complete the addGame() and getGame() methods. Create a base class called Entity. The Entity class must hold the common attributes and behaviors (as shown in the UML diagram provided in the Supporting Materials section below). Refactor the Game class to inherit from this new Entity class. Complete the code for the Player and Team classes. Each class must derive from the Entity class, as demonstrated in the UML diagram. Every team and player must have a unique name by searching for the supplied name prior to adding the new instance. Use the iterator pattern in the addTeam() and addPlayer() methods. Functionality and Best Practices Once you are finished coding, use the main() method provided in the ProgramDriver class to run and test the game application to ensure it is functioning properly.
  • 2. Be sure your code demonstrates industry standard best practices to enhance the readability of your code, including appropriate naming conventions and in-line comments that describe the functionality. Here is my answer that I need a little improvement on its code since I am having trouble making it right. Here I am attaching code for these Files: Entity.java Game.java Team.java Player.java GameService.java ProgramDriver.java SingletonTester.java Source Code for Entity.java package com.gamingroom; public class Entity { long id; String name; /* * the default constructor */ public Entity() { } /* * Constructor with a identifier and name */ public Entity (long id, String name) { this.id = id; this.name = name; } /* * @return id */ public long getId() {
  • 3. return this.id; } /* * @return name */ public String getName() { return this.name; } @Override public String toString() { return "Entity [id=" + id + ", name=" + name + "]"; } } Source code for Game.java: package com.gamingroom; import java.util.ArrayList; import java.util.List; /** * A simple class to hold information about a game * * * Notice the overloaded constructor that requires * an id and name to be passed when creating. * Also note that no mutators (setters) defined so * these values cannot be changed once a game is * created. * * * @author coce@snhu.edu * */
  • 4. public class Game extends Entity { /** * Hide the default constructor to prevent creating empty instances. */ private static List teams = new ArrayList(); /** * Constructor with an identifier and name */ public Game(long id, String name) { this.id = id; this.name = name; } public Team addTeam(String name) { // a local team instance Team team = null; //search through the teams if the name exist return it. for(int i = 0; i < teams.size(); ++i) { if (name.equalsIgnoreCase(teams.get(i).getName())) { team = teams.get(i); } } // if not found, make a new team insatnce and add to list of teams if (team == null) { team = new Team((long) teams.size(), name); teams.add(team); } return team; } @Override public String toString() {
  • 5. return "Game [id=" + id + ", name=" + name + "]"; } } Source Code for Team.Java package com.gamingroom; import java.util.ArrayList; import java.util.List; /** * A simple class to hold information about a team * * Notice the overloaded constructor that requires * an id and name to be passed when creating. * Also note that no mutators (setters) defined so * these values cannot be changed once a team is * created. * * @author coce@snhu.edu * */ public class Team extends Entity { private static List players = new ArrayList(); /* * Constructor with an identifier and name */ public Team(long id, String name) { this.id = id; this.name = name; }
  • 6. public Player addPlayer (String name) { //a local team insatnce Player player = null; //search through the teams if the name name exist return it. for (int i = 0; i < players.size(); ++i) { if (name.equalsIgnoreCase(players.get(i).getName())) { player = players.get(i); } } // if not found, make a new team instance and add to list of teams if (player == null) { player = new Player((long) players.size(), name); players.add(player); } //return the name existing team instance to the caller. return player; } //@override public String toString() { return "Entity [id=" + id + ", name=" + name + "]"; } } Source code for Player.java: package com.gamingroom; /** * A simple class to hold information about a player * * Notice the overloaded constructor that requires * an id and name to be passed when creating. * Also note that no mutators (setters) defined so * these values cannot be changed once a player is
  • 7. * created. * * @author coce@snhu.edu * */ public class Player extends Entity { long id; String name; /* * Constructor with an identifier and name */ public Player(long id, String name) { this.id = id; this.name = name; } @Override public String toString() { return "Player [id=" + id + ", name=" + name + "]"; } } Source code for GameService.java: package com.gamingroom; import java.util.ArrayList; import java.util.List; /** * A singleton service for the game engine * * @author Bryan Molina****** */ public class GameService { /** * A list of the active games
  • 8. */ private static List games = new ArrayList(); /* * Holds the next game identifier */ private static long nextGameId = 1; private static long nextTeamId = 1; private static long nextPlayerId = 1; // Creating a local instance of this class. Since our constructor is private, // we know that we will only have this one instance of this object making it a singleton. private static GameService service = new GameService(); // it is normal for a singleton to have a private constructor so that we don't make additional instances outside the class. private GameService() { } //Public accessor for our instance will allow outside classes to access objects in this Singleton Class public static GameService getInstance() { return service; } //This is the new line for the assignment ** Bryan Molina /** * Construct a new game instance * * @param name the unique name of the game * @return the game instance (new or existing) */ public Game addGame(String name) {
  • 9. // a local game instance Game game = null; for(int i = 0; i < getGameCount(); ++i ) { if (name.equalsIgnoreCase(games.get(i).getName())) { game = games.get(i); } } if (game == null) { game = new Game(nextGameId++, name); games.add(game); } return game; } Game getGame(int index) { return games.get(index); } /** * Returns the game instance with the specified id. * * @param id unique identifier of game to search for * @return requested game instance */ public Game getGame(long id) { // a local game instance Game game = null; // FIXME: Use iterator to look for existing game with same id // if found, simply assign that instance to the local variable for (int i = 0; i < getGameCount(); ++i) {
  • 10. if (games.get(i).getId() == id) { game = games.get(i); } } return game; } /** * Returns the game instance with the specified name. * * @param name unique name of game to search for * @return requested game instance */ public Game getGame(String name) { // a local game instance Game game = null; // FIXME: Use iterator to look for existing game with same name // if found, simply assign that instance to the local variable for(int i = 0; i< getGameCount(); ++i ) { if(name.equalsIgnoreCase(games.get(i).getName())) { game = games.get(i); } } return game; } /** * Returns the number of games currently active * * @return the number of games currently active */ public int getGameCount() {
  • 11. return games.size(); } public long getNextPlayerId() { return nextPlayerId++; } public long getNextTeamId() { return nextTeamId++; } } Source code for ProgramDriver.java: package com.gamingroom; /** * Application start-up program * * @author Bryan Molina *** */ public class ProgramDriver { /** * The one-and-only main() method * * @param args command line arguments */ public static void main(String[] args) { // FIXME: obtain reference to the singleton instance GameService service = GameService.getInstance(); System.out.println("nAbout to test initializing game data..."); // initialize with some game data Game game1 = service.addGame("Game #1"); System.out.println(game1); Game game2 = service.addGame("Game #2");
  • 12. System.out.println(game2); // use another class to prove there is only one instance SingletonTester tester = new SingletonTester(); tester.testSingleton(); } } Source code for SingletonTester.java: package com.gamingroom; /** * A class to test a singleton's behavior * * @author Bryan Molina ***** */ public class SingletonTester { public void testSingleton() { System.out.println("nAbout to test the singleton..."); // FIXME: obtain local reference to the singleton instance GameService service = GameService.getInstance(); // a simple for loop to print the games for (int i = 0; i < service.getGameCount(); i++) { System.out.println(service.getGame(i)); } } } ProgramDriver (1) [Java Application] CiProgram FilesJavaljdk-19 binljavaw.exe (Mar 18,
  • 13. 2023, 9:32:50 PM - 9:32:52 PM) [pid: 44352] About to test initializing game data... Game [id=1, name=Game #1] Game [ id =2, name = Game #2] About to test the singleton... Game [ id =1, name=Game #1] Game [ id =2, name = Game #2]