Recent Question

Hi. I need help with this java assignment.
As i have been your regular student and have been getting good ones, i hope i will get the best one this time as well.
There are some criteria to be fulfilled so i hope you will go through that .
THanks .

Suitcases and Player Game Programming
Assignment
Due: Week 12 Thursday 7 June, 2018 at 5 pm (Demo in week 12 class)
***No late submission***
Marks: The assignment is assessment for 15% of final mark for the unit.
You are to work alone. No group submission allowed. Must submit before 5PM on June 7, one copy of the assignment. Submission details are at the end of this document. The assignment is composed of two parts.
Problem Description
You are being asked to code a game called the Suitcases and Player Game that is loosely based on the television game known as ‘Deal or No Deal’ . Banker and you the only players in the game, there can be only one winner.
For the assignment version, there are 3 different suitcases. The suitcases are numbered 1, 2 and 3 and each contains a sum of money. Each time the game is run, at random, one suitcase is chosen to contain $20, the second suitcase to contain $50 and the third suitcase has $100. As one example, suitcase 1 may contain $100, suitcase 2 may have $20 and then suitcase 3 contains $50. Next, the player selects one of the three suitcases. Note that the player does not know what each suitcase contains.
To see if the player wins the game, the value of the player’s suitcase is compared to the sum of values in the other two suitcases. If the player’s suitcase contains a value higher than the sum of the other two suitcases, then the player is declared the winner; otherwise the banker is said to win.
There are two versions of the game, one is a Command Line (DOS) window application as described in Part 1 of the specification and the other one is a GUI, a JFrame version as described in Part 2. The classes created in Part 1 will be reused in Part 2 of the assignment. You will need to code several classes to implement this game in Java. As a minimum, it is expected that you will need a class Suitcase representing a suitcase in the game, and a class Player representing the player in the game.
Part 1
Create a COMMAND LINE based application that prints out a welcome message and then asks the user to select a suitcase. After the user types a number, the game runs as shown in the following screen printouts.
2
Several more examples of the DOS based application are shown below.
Notice, when a number greater than 3 is entered, the program does not stop but assumes the user selected suitcase 3.
Each time the game is run, 3 instances of class Suitcase must be made. One instance has the label 1 with a value of $20 or $50 or $100 randomly placed in it. Another instance has the label 2, with a different value placed in it and the third instance has the label 3 and the final value placed in it.
A basic UML diagram for a class Suitcase representing a suitcase is shown Suitcase on the right side of the page.
– label : int
– value : int
– any other variables + Suitcase(int)
+ any other methods you think necessary
After the 3 instances of class Suitcase are created, an instance of class Player is needed. A player knows which instance of class suitcase they have chosen.
A basic UML diagram for a class Player representing a player is shown. Then, a calculation is done to decide if the player or the banker wins the game.
Part 2
Create a Windows GUI application using the following code.
import javax.swing.*;
public class DisplayGame
{
public static void
main(String[] args)
Player
– pickedCase : Suitcase
+ Player( Suitcase )
+ getSuitcaseValue( ) : int
+ toString( ) : String
{ JFrame w1 = new JFrame(-Suitcases and Player Game-);
GamePanel myGamePanel = new GamePanel( ); w1.add (myGamePanel) ;
w1.setSize(275, 240);
w1.setVisible(true);
w1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}//end main
}//end class
4

When the Windows application is running, an instance of class GamePanel displays three JButtons, each representing a suitcase, together with a JLabel and a JTextArea.
When the user clicks on any of the displayed JButtons, the Suitcases and Player game runs. Then an appropriate result appears in the JTextArea as shown on the next page.
5
Sample Screen Shots
Submission Details and Marking Scheme
It is compulsory that you demonstrate your work to your lab instructor in week 12 class and submit an electronic version on VU Collaborate by or before the due date (Thursday 7th of June, 2018 at 5pm). Email submissions will not be accepted.
Assignment demonstration (20 minutes) is scheduled in the last week class. During the demonstration, you will be asked questions on your work and to modify/update code. If you are unable to answer or modify/update code during the demo, you may get zero for the assignment.
6
Students to work alone
Assignment must be clearly labeled with student name and student ID number. All work must be the your own. Any unauthorized collaboration or copying will result in zero for the assignment and possible overall failure in the subject.
What do you have to hand in?
An electronic copy of
1. Readme.doc file with information on how to run your program. Include any extra information about your design and program that you wish the marker to know.
2. Summary of tasks allocations — who did what?
3. A word document with the evidence of trial runs of your program, i.e., screens printouts of the results where you have tested all the features of your code.
4. UML diagram for all classes in your program.
5. Code for all the classes that has been compiled and is ready to run.
Each class should be fully documented commencing with a heading. In particular, the heading should include your name, unit, assignment details, date written and a brief description of the class. At the start of each method, there should be a comment clearly describing what the method does.
NIT2112 – Assignment
Name………………….. Name………………….. ID No………………….
ID No………………….
Markers Guideline
Appropriate design including UML class diagrams and description of how to solve the problem plus readme.txt file. Printout of extensive trial runs
15 marks
7
class Suitcase – design and implementation
15 marks
class Player – design and implementation
15 marks
Other classes for COMMAND LINE application – Game play design and implementation.
15 marks
class GamePanel –
Windows application –design and implementation.
Any other classes. 15 marks
Output & Functionality – program works and meets specification.
Whole Program –
• Originality, user friendliness and presentation.
• Appropriate commenting of code and readability of the code. 25 marks
Total
100 marks

Disclaimer : LiveWebExperts.com provides assignment and homework help for guidance and reference purpose only. These papers are not to be submitted as it is. These papers are intended to be used for research and reference purposes only.