Assignment Scope For this assignment students will begin developing the front en
ID: 3600887 • Letter: A
Question
Assignment Scope
For this assignment students will begin developing the front end, or User Interface, portion of the MasterMind game. Based on my professional experience working in the industry I have always had to develop a UI for every application, therefore I translate that experience to students so they can have the same opportunity and be prepared professionally.
Typically, there is a one-to-one correlation of back end functionality to front end UI component. Depending upon the design of the application it doesn’t always correlate perfectly, however with MasterMind, it works well.
Back-end functionality
Front-end UI component
Codemaker.java
CodemakerUi.java
Codebreaker.java
CodebreakerUi.java
Game.java
MasterMindUi.java
The goal is to develop the front-end components of the game MasterMind by creating classes:
CodebreakerUi.java
CodemakerUi.java
MasterMindUi.java
Students will also begin to learn writing simple ActionListeners or Event Handlers.
The UI will be developed in multiple assignments, it is not expected that for Assignment 4 the fully functioning UI is complete.
The image that follows is a prototype of what the UI will look like. It does not have to be an exact match. The rubric will provide guidance and recommendations on how to accomplish this, however feel free to be creative in developing the look and feel of the UI.
To accomplish this:
Reference the tasks below for the specifics of the source code requirements.
Compress a project and submit to Webcourses
Decompress compressed project and verify it is a Netbeans project
References
Netbeans.docx
Setting up a project in Netbeans.docx
Netbeans right click menu help.docx
Deliverables
To complete this assignment you must submit your compressed Netbeans project to Webcourses.
Please keep in mind that the tasks are guidance to accomplish the goals of the assignment. At times students will be required to do additional research (e.g. Google That S**T (GTS)!) to find implementation options. In the industry, software engineers are expected to be very self-sufficient to find the best solution for the task at hand.
I have provided multiple code examples on Webcourses that shows how to implement numerous of the tasks below, please reference those code examples prior to asking me for help!
Tasks and Rubric
Activity
mastermind package
Mastermind.java
Instantiate an instance of class MastermindUi, passing the reference object of class Game as an argument
core package
Game.java
In the customer constructor, comment out the call the method play()
userInterface package
MastermindUi.java
Game game;
CodebreakerUi codebreakerUi;
CodemakerUi codemakerUi;
JFrame frame;
JMenuBar menuBar;
JMenu gameMenu;
JMenu helpMenu;
JMenuItem newGameMenuItem;
JMenuItem exitMenuItem;
JMenuItem aboutMenuItem;
JMenuItem rulesMenuItem;
Set member variable of type class Game to the parameter passed in
Instantiate the member variable of class CodebreakerUi passing as an argument to the constructor the instance of class Codebreaker in class Game (hint: use the getter!)
Instantiate the member variable of class CodemakerUi passing as an argument to the constructor the instance of class Codemaker in class Game (hint: use the getter!)
call method initComponents()
Set the default size of the JFrame
Set the default close operation of the JFrame
Use default layout manager BorderLayout
Set up the JMenuBar
i.JMenu Game should be added to the JMenuBar
ii.JMenuItems New Game and Exit should be added to the JMenu Game
iii.JMenu Help should be added to the JMenuBar
iv.JMenuItems About and Game Rules should be added to the JMenu Help
JMenuBar should be set on the JFrame
Add the CodemakerUi JPanels to the JFrame using the getters defined in the class
Add the CodebreakerUi JPanels to the JFrame using the getters defined in the class
Set the visibility of the JFrame (hint: this should ALWAYS be the last step on a UI)
Write an inner class to create an ActionListener that is registered to the JMenuItem with the text Exit; it should
Display a JOptionPane message confirming the user wants to exit using method showConfirmDialog()
If yes, exit the application by calling method System.exit() passing the value of 0 as an argument
If no, do not exit the application
Write an inner class to create an ActionListener that is registered to the JMenuItem with the text About using method showMessageDialog(); it should
Application name and version
Author
Date of development
Write an inner class to create an ActionListener that is registered to the JMenuItem with the text Game Rules using method showMessageDialog(); it should
Rules of the game as shown in Figure 6 below
CodebreakerUi.java
JPanel codebreakerAttempt;
JPanel codebreakerColors;
Codebreaker codebreaker;
Create getters for the two JPanel member variables
Set member variable of type class Codebreaker to the parameter passed in
call method initComponents()
For each JPanel
i.Set the size of the JPanel using two methods to ensure the UI isn’t too small
setMinimumSize()
setPreferredSize()
ii.Add a titled border for each using method
setBorder(BorderFactory.createTitledBorder("Codebreaker Attempt"));
This can be temporary, it just shows the layout while there aren’t any buttons or other components in the JPanels
CodemakerUi.java
JPanel codemakerResponse;
JPanel secretCode;
Codebreaker codemaker;
Create getters for the two JPanel member variables
Set member variable of type class Codemaker to the parameter passed in
call method initComponents()
For each JPanel
i.Set the size of the JPanel using two methods to ensure the UI isn’t too small
setMinimumSize()
setPreferredSize()
ii.Add a titled border for each using method
setBorder(BorderFactory.createTitledBorder("Codemaker Response"));
This can be temporary, it just shows the layout while there aren’t any buttons or other components in the JPanels
Mastermind application
Test Case 1
Test Case 1 passes
Test Case 2
Test Case 2 passes
Test Case 3
Test Case 3 passes
Source compiles with no errors
Source runs with no errors
Source includes comments
Total
Perform the following test cases
Test Cases
Action
Expected outcome
Test Case 1
Rregression Testing: Initial JOptionPane displays
JOptionPane is similar to figure 1
Test Case 2
Mastermind Initial UI displays
Mastermind UI looks similar figure 2
Test Case 3
Mastermind Game Menu
Game menu looks similar to figure 3
Test Case 4
Mastermind Help Menu
Help menu looks similar to figure 4
Test Case 5
About Menu Item Action Listener
JOptionPane displays similar to figure 5
Test Case 6
Rules Menu Item Action Listener
JOptionPane displays similar to figure 6
Test Case 7
Exit Menu Item Action Listener
JOptionPane displays similar to figure 7;
if user selects yes, the application should exit;
if user selects no, the application continues to run
Test Case 8
Project view
Project view matches figure 8
Figure 1 Test Case 1
Figure 2 Mastermind Initial UI
Figure 3 Game Menu
Figure 4 Help Menu
Figure 5 About Menu Item
Figure 6 Rules Menu Item
Figure 7 Exit Menu Item
Figure 8 Project View
Edit provided-
Game.Java:
Codemaker:
Codebreaker:
Back-end functionality
Front-end UI component
Codemaker.java
CodemakerUi.java
Codebreaker.java
CodebreakerUi.java
Game.java
MasterMindUi.java
CheckExplanation / Answer
#include #include #include #include #include #include using namespace std; int main(){ int choose; int choose2; int c1, c2, c3, c4; int g1, g2, g3, g4; //int D; //bool menu = true; MenuOne: coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.