Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Course Assignment A game program Purpose: Reading Java code and identifying the essential components - instance variables, method declarations, local variables Reading and writing Java

Course Assignment A game program

Purpose:

Reading Java code and identifying the essential components - instance variables, method

declarations, local variables

Reading and writing Java code that uses the following concepts:

Writing appropriate documentation

The Game:

Conditions to win as user

Getting as close to a score of 21 as possible

Having 5 cards and a score of 21 or less

Playing procedure

1.

The user told about the game, and invited to play

2.

Four cards are dealt: user, computer, user, computer

3.

Computers cards be hidden, others shown

4.

User choose: hit to have an additional card; sit/stand not to stop taking card

5.

Computer take cards once the user finished (sit/stand)

6.

Computer takes card if their total be less than 16, and user not bust

Detailed explanation

Pontoon is a card game played with three decks of playing cards (i.e. cards of 2-10, Jack,

Queen, King, and Ace from the four suits of Hearts, Diamonds, Spades, and Clubs).

There are two players: the user of the computer, and the computer itself. The object of the

game is to beat the other player by either getting as close to a score of 21 as possible (without

exceeding 21) or by having 5 cards and a score of 21 or less.

Each card has a value: numeric cards have their numeric value, 'face' cards have value 10,

and aces have value 11.

The game is played as follows,

Firstly the user is told about the game and invited to play. If they opt to play then four cards

are dealt. The first card goes to the user, the second to the computer, the third to the user,

and the fourth to the computer. The computer's card remains hidden, all others are shown.

The user can then indicate they wish to have an additional card ("hit"). If they are this card

is also displayed. Additional cards may be taken until either the user's score exceeds 21 (they

"bust"), or they choose not to take another card ("sit"/"stand"). Once the user has finished

taking cards the computer will take cards. The computer will always take a card if their total

is less than 16 (and the user's score doesn't exceed 21).

Requirement:

Files included

- AssigTwo2021.java (The main class/driven class with the main method. Do NOT edit!)

- Decks.java (The class for cards and decks. Do NOT edit! Only for invoke) - Pontoon.java (GUI and action listeners. The GUI is needed if applicable. MUST be edited!)

Detailed requirements:

- Read and understand the given program

- Modify and redefine (if needed) the class Pontoon (or the methods within it), to

organize the game, and interactions with the users

- Must NOT modify the other two source code files (AssigTwo2021.java & Decks.java)

- create and use objects of Decks class. NO duplicate things belong to Decks class

- use the trace(), switch off before submission

- separate methods to implement separate tasks

- instance variables (used more than one method)

- local variables to store data used by just one method

Targets

Stage 1: Complete the program to meet the same functions to targetStage1.jar, including the

GUI, components, contents, event handling, etc.

Stage 2 (optional): Complete the program to meet the same functions to targetStage2.jar,

including the prompt info on console, logics of the program, etc.

Stage 3(optional): complete the program according to the above listed requirements,

improve the GUI, functions and user experiences.

TIPS:

The program is runnable with the provided code. You need to modify the file Pontoon.java

to meet the requirements and accomplish the targets.

Use following commands in console to run a JAR program:

java jar targetStage2.jar

Provided files

targetStage1.jar

targetStage2.jar

AssigTwo2021.java

Decks.java

Pontoon.java

Material directory (for Pontoon)

Submission requirement

- A word file (without anything else)

- Including codes only from Pontoon.java for each stage

- Specify within the word file which stage your submission meets (for each section of

codes)

All the materials and java files

https://disk.yandex.com/d/mGn7YwRvPbkzJQ

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

More Books

Students also viewed these Databases questions

Question

Distinguish between poor and good positive and neutral messages.

Answered: 1 week ago

Question

Describe the four specific guidelines for using the direct plan.

Answered: 1 week ago