This is my current ide code for gui highsum game:

“import GUIExample.GameTableFrame;
import Model.;
import GUIExample.LoginDialog;

public class GUIExample {

private Dealer dealer;
private Player player;
private GameTableFrame app;

public GUIExample() {
}

public void run() {
dealer.shuffleCards();
app = new GameTableFrame(dealer, player);
app.run();
}

public static void main(String[] args) {
LoginDialog loginDialog = new LoginDialog(null);
loginDialog.setVisible(true);

if (loginDialog.isLoggedIn()) {
String login = loginDialog.getLogin();
String password = loginDialog.getPassword();

GUIExample example = new GUIExample();
example.dealer = new Dealer();
example.player = new Player(login, password, 10000);
example.run();
}
}
}
import Model.;
import Controller.;
import View.;
import GUIExample.LoginDialog;

public class HighSum {

private Dealer dealer;
private Player player;
private ViewController view;
private GameController gc;
private int chipsOnTable;

public HighSum() {
}

public void init(String login, String password) {
// Create all the required objects
this.dealer = new Dealer();
this.player = new Player(login, password, 50);
this.view = new ViewController();

// Bring them together
this.gc = new GameController(this.dealer, this.player, this.view);
}

private Player checkWinner() {
if(player.getTotalCardsValue() > dealer.getTotalCardsValue())
return player;
else if(player.getTotalCardsValue() < dealer.getTotalCardsValue())
return dealer;
else
return null;
}

public void run() {
// Starts the game!
boolean carryOn = true;

while (carryOn) {
runOneRound();
if (!gc.getPlayerQuitStatus()) {
char r = this.view.getPlayerNextGame();
if (r == ‘n’) {
carryOn = false;
}
} else {
carryOn = false;
}
}
this.view.displayPlayerNameAndLeftOverChips(this.player);
this.view.displayExitGame();
}

public void runOneRound() {
this.view.displayGameTitle();
this.view.displayDoubleLine();
this.view.displayPlayerNameAndChips(this.player);
this.view.displaySingleLine();
this.view.displayGameStart();
this.view.displaySingleLine();
this.dealer.shuffleCards();
this.chipsOnTable = 0;
boolean playerQuit = false;

for (int round = 1; round <= 4; round++) {
// Code remains same until here

// Check if the player wants to follow or quit
char r;
int chipsToBet;
if (round == 1) {
chipsToBet = this.view.getPlayerCallBetChip(this.player);
} else {
chipsToBet = this.view.getDealerCallBetChips();
}
}
Player winner = checkWinner();
if(playerQuit){
this.view.displayPlayerNameAndLeftOverChips(this.player);
this.view.displayPlayerQuit();
}
}

public static void main(String[] args) {
LoginDialog loginDialog = new LoginDialog(null);
loginDialog.setVisible(true);

if (loginDialog.isLoggedIn()) {
String login = loginDialog.getLogin();
String password = loginDialog.getPassword();

HighSum highSum = new HighSum();
highSum.init(login, password);
highSum.run();
}
}
}



package Controller;
import Model.Dealer;
import Model.Player;
import View.ViewController;

public class GameController {

private Dealer dealer;
private Player player;
private ViewController view;
private int chipsOnTable;
private boolean playerQuit;

public GameController(Dealer dealer,Player player,ViewController view) {
this.dealer = dealer;
this.player = player;
this.view = view;
this.chipsOnTable = 0;
}

public boolean getPlayerQuitStatus() {
return playerQuit;
}

public void run() {

boolean carryOn= true;

while(carryOn) {
runOneRound();
char r = this.view.getPlayerNextGame();
if(r==‘n’) {
carryOn = false;
}
}
this.view.displayPlayerNameAndLeftOverChips(this.player);
this.view.displayExitGame();
}

public void runOneRound() {

this.view.displayGameTitle();
this.view.displayDoubleLine();
this.view.displayPlayerNameAndChips(this.player);
this.view.displaySingleLine();
this.view.displayGameStart();
this.view.displaySingleLine();
this.dealer.shuffleCards();
this.chipsOnTable = 0;
boolean playerQuit = false;

for(int round = 1;round<=4;round++) {
this.view.displaySingleLine();
this.view.displayDealerDealCardsAndGameRound(round);
this.view.displaySingleLine();

if (round == 1) { //round 1 deal extra card
this.dealer.dealCardTo(this.player);
this.dealer.dealCardTo(this.dealer);
} else {
this.dealer.dealCardTo(this.player);
this.dealer.dealCardTo(this.dealer);
}

this.view.displayPlayerCardsOnHand(this.dealer);
this.view.displayBlankLine();
this.view.displayPlayerCardsOnHand(player);
this.view.displayPlayerTotalCardValue(player);

int whoCanCall = this.dealer.determineWhichCardRankHigher(dealer.getLastCard(), player.getLastCard());

if(whoCanCall==1) {//dealer call
int chipsToBet = this.view. getDealerCallBetChips();
//ask player want to follow?
char r = this.view.getPlayerFollowOrNot(this.player,chipsToBet);
if(r==‘y’) {
this.player.deductChips(chipsToBet);
this.chipsOnTable+=2chipsToBet;
this.view.displayPlayerNameAndLeftOverChips(this.player);
this.view.displayBetOntable(this.chipsOnTable);
}else {
playerQuit = true;
break;
}
}else {//player call
if(round==1) {//round 1 player cannot quit
int chipsToBet = view.getPlayerCallBetChip(this.player);
this.player.deductChips(chipsToBet);
this.chipsOnTable+=2chipsToBet;
this.view.displayBetOntable(this.chipsOnTable);
}else {
char r = this.view.getPlayerCallOrQuit();
if(r==‘c’) {
int chipsToBet = view.getPlayerCallBetChip(this.player);
this.player.deductChips(chipsToBet);
this.chipsOnTable+=2chipsToBet;
this.view.displayPlayerNameAndLeftOverChips(this.player);
this.view.displayBetOntable(this.chipsOnTable);
}else {
playerQuit = true;
break;
}
}
}
}

//check who win
if(playerQuit) {
this.view.displayPlayerNameAndLeftOverChips(this.player);
this.view.displayPlayerQuit();
}
else if(this.player.getTotalCardsValue()>this.dealer.getTotalCardsValue()) {
this.view.displayPlayerWin(this.player);
this.player.addChips(chipsOnTable);
this.chipsOnTable=0;
this.view.displayPlayerNameAndLeftOverChips(this.player);
}else if(this.player.getTotalCardsValue()<this.dealer.getTotalCardsValue()) {
this.view.displayDealerWin();
this.view.displayPlayerNameAndLeftOverChips(this.player);
}else {
this.view.displayTie();
this.player.addChips(chipsOnTable/2);
this.view.displayPlayerNameAndLeftOverChips(this.player);
}

//put all the cards back to the deck
dealer.addCardsBackToDeck(dealer.getCardsOnHand());
dealer.addCardsBackToDeck(player.getCardsOnHand());
dealer.clearCardsOnHand();
player.clearCardsOnHand();
}
}


package GUIExample;

import java.awt.;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.;
import Model.;

public class GameTableFrame extends JFrame{

private GameTablePanel gameTablePanel;
private Dealer dealer;
private Player player;
private JLabel shufflingLabel;
private JButton playButton;
private JButton quitButton;

public GameTableFrame(Dealer dealer, Player player)
{
this.dealer = dealer;
this.player = player;
gameTablePanel = new GameTablePanel(dealer,player);

shufflingLabel = new JLabel(“Shuffling”);
shufflingLabel.setHorizontalAlignment(SwingConstants.CENTER);
playButton = new JButton(“Play”);
quitButton = new JButton(“Quit”);

playButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
shufflingLabel.setVisible(true);
run();
}
});

quitButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});

JPanel buttonsPanel = new JPanel();
buttonsPanel.add(playButton);
buttonsPanel.add(quitButton);

add(gameTablePanel, BorderLayout.CENTER);
add(buttonsPanel, BorderLayout.SOUTH);
add(shufflingLabel, BorderLayout.NORTH);
shufflingLabel.setVisible(false);
pack();
setVisible(true);
}

public void run() {
for (int i = 0; i < 5; i++) {
dealer.dealCardTo(dealer);
dealer.dealCardTo(player);
gameTablePanel.repaint();
pause();
}

shufflingLabel.setVisible(false);
gameTablePanel.repaint();
}

private void pause() {
try{
Thread.sleep(500);
}catch(Exception e){}
}
}

package GUIExample;
import java.awt.;
import javax.swing.;

import Model.;

public class GameTablePanel extends JPanel {

private Player player;
private Dealer dealer;
private ImageIcon cardBackImage;

public GameTablePanel(Dealer dealer, Player player) {

setBackground(Color.GREEN);
setPreferredSize(new Dimension(1024, 768));

cardBackImage = new ImageIcon(“images/back.png”);
this.dealer = dealer;
this.player = player;

}

public void paintComponent(Graphics g) {
super.paintComponent(g);

int x = 50;
int y = 70;

// Add the label “Dealer”
g.setColor(Color.BLACK);
g.setFont(new Font(“Arial”, Font.PLAIN, 18));
g.drawString(“Dealer”, x, y - 20);

int i = 0;
for (Card c : dealer.getCardsOnHand()) {
// Display dealer cards
if (i == 0) {
cardBackImage.paintIcon(this, g, x, y);
i++;

} else {
c.paintIcon(this, g, x, y);
}

x += 200;
}

// Display “Deck” label
g.drawString(“Deck”, x, y + 100);

// Display player cards
x = 50;
y = 550;

// Add the label “Player”
g.setColor(Color.BLACK);
g.setFont(new Font(“Arial”, Font.PLAIN, 18));
g.drawString(“Player”, x, y - 20);

for (Card c : player.getCardsOnHand()) {
c.paintIcon(this, g, x, y);
x += 200;
}

// Display “Chips on the table:”
g.setColor(Color.BLACK);
g.setFont(new Font(“Arial”, Font.PLAIN, 18));
g.drawString(“Chips on the table:”, x - 950, y - 250);

}
}
package GUIExample;

import javax.swing.;
import java.awt.;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class LoginDialog extends JDialog {

private JTextField loginField;
private JPasswordField passwordField;
private JButton loginButton;
private boolean loggedIn = false;

public LoginDialog(JFrame parent) {
super(parent, “Login”, true);

loginField = new JTextField(20);
passwordField = new JPasswordField(20);
loginButton = new JButton(“Login”);

loginButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
loggedIn = true;
dispose();
}
});

JPanel panel = new JPanel();
panel.setLayout(new GridLayout(3, 2));
panel.add(new JLabel(“Login:”));
panel.add(loginField);
panel.add(new JLabel(“Password:”));
panel.add(passwordField);
panel.add(loginButton);

add(panel);

pack();
setLocationRelativeTo(parent);
}

public String getLogin() {
return loginField.getText();
}

public String getPassword() {
return new String(passwordField.getPassword());
}

public boolean isLoggedIn() {
return loggedIn;
}
}
package Helper;
public class Keyboard {

public static String readString(String prompt) {
System.out.print(prompt);
return new java.util.Scanner(System.in).nextLine();
}

public static int readInt(String prompt) {
int input = 0;
boolean valid = false;
while (!valid) {
try {
input = Integer.parseInt(readString(prompt));
valid = true;
} catch (NumberFormatException e) {
System.out.println("** Please enter an integer “);
}
}
return input;
}

public static double readDouble(String prompt) {
double input = 0;
boolean valid = false;
while (!valid) {
try {
input = Double.parseDouble(readString(prompt));
valid = true;
} catch (NumberFormatException e) {
System.out.println(” Please enter a double “);
}
}
return input;
}

public static float readFloat(String prompt) {
float input = 0;
boolean valid = false;
while (!valid) {
try {
input = Float.parseFloat(readString(prompt));
valid = true;
} catch (NumberFormatException e) {
System.out.println(” Please enter a float “);
}
}
return input;
}

public static long readLong(String prompt) {
long input = 0;
boolean valid = false;
while (!valid) {
try {
input = Long.parseLong(readString(prompt));
valid = true;
} catch (NumberFormatException e) {
e.printStackTrace();
System.out.println(” Please enter a long “);
}
}
return input;
}



public static char readChar(String prompt,char[] choices) {
boolean validChoice = false;
char r = ’ ';
while(!validChoice) {
r = Keyboard.readChar(prompt+” “+charArrayToString(choices)+”:“);
if(!validateChoice(choices,r)) {
System.out.println(“Invalid input”);
}else {
validChoice = true;
}
}
return r;
}

private static String charArrayToString(char[] charArray) {
String s = “[”;
for(int i=0;i<charArray.length;i++) {
s+=charArray[i];
if(i!=charArray.length-1) {
s+=”,“;
}
}
s += “]”;
return s;
}

private static boolean validateChoice(char[] choices, char choice) {
boolean validChoice = false;
for(int i=0;i<choices.length;i++) {
if(choices[i]==choice) {
validChoice = true;
break;
}
}
return validChoice;
}

public static char readChar(String prompt) {
char input = 0;
boolean valid = false;
while (!valid) {
String temp = readString(prompt);
if (temp.length() != 1) {
System.out.println(” Please enter a character “);
} else {
input = temp.charAt(0);
valid = true;
}
}
return input;
}

public static boolean readBoolean(String prompt) {
boolean valid = false;
while (!valid) {
String input = readString(prompt);
if (input.equalsIgnoreCase(“yes”) || input.equalsIgnoreCase(“y”) || input.equalsIgnoreCase(“true”)
|| input.equalsIgnoreCase(“t”)) {
return true;
} else if (input.equalsIgnoreCase(“no”) || input.equalsIgnoreCase(“n”) || input.equalsIgnoreCase(“false”)
|| input.equalsIgnoreCase(“f”)) {
return false;
} else {
System.out.println(” Please enter Yes/No or True/False “);
}
}
return false;
}

public static java.util.Date readDate(String prompt) {
java.util.Date date = null;
boolean valid = false;
while (!valid) {
try {
String input = readString(prompt).trim();
if (input.matches(”\d\d/\d\d/\d\d\d\d")) {
int day = Integer.parseInt(input.substring(0, 2));
int month = Integer.parseInt(input.substring(3, 5));
int year = Integer.parseInt(input.substring(6, 10));
java.util.Calendar cal = java.util.Calendar.getInstance();
cal.setLenient(false);
cal.set(year, month - 1, day, 0, 0, 0);
date = cal.getTime();
valid = true;
} else {
System.out.println(" Please enter a date (DD/MM/YYYY) “);
}
} catch (IllegalArgumentException e) {
System.out.println(” Please enter a date (DD/MM/YYYY) “);
}
}
return date;
}

private static String quit = “0”;

public static int getUserOption(String title, String[] menu) {
displayMenu(title, menu);
int choice = Keyboard.readInt(“Enter Choice --> “);
while (choice > menu.length || choice < 0) {
choice = Keyboard.readInt(“Invalid Choice, Re-enter --> “);
}
return choice;
}

private static void displayMenu(String title, String[] menu) {
line(80, “=”);
System.out.println(title.toUpperCase());
line(80, “-”);
for (int i = 0; i < menu.length; i++) {
System.out.println(”[” + (i + 1) + “] " + menu[i]);
}
System.out.println(”[” + quit + “] Quit”);
line(80, “-”);
}

public static void line(int len, String c) {
System.out.println(String.format(”%” + len + “s”, " “).replaceAll(” “, c));
}
}
package Helper;

import java.security.MessageDigest;

public class Utility {

public static String getHash(String base)
{
String message=”“;

try{
MessageDigest digest = MessageDigest.getInstance(“SHA-256”);
byte[] hash = digest.digest(base.getBytes(“UTF-8”));
StringBuffer hexString = new StringBuffer();

for (int i = 0; i < hash.length; i++) {
String hex = Integer.toHexString(0xff & hash[i]);
if(hex.length() == 1) hexString.append(‘0’);
hexString.append(hex);
}

message = hexString.toString();

} catch(Exception ex){
throw new RuntimeException(ex);
}

return message;
}

public static void printLine(int num)
{
printLine(num,‘-’);
}

public static void printDoubleLine(int num)
{
printLine(num,‘=’);
}


public static void printLine(int num,char pattern)
{
for(int i =0;i<num;i++)
{
System.out.print(pattern);
}
System.out.println(”");

}

}
package Model;
import javax.swing.;

public class Card extends ImageIcon {
private String suit;
private String name;
private int value;
private int rank;
private boolean faceDown;

public Card(String suit, String name, int value, int rank) {
super(“images/” + suit + name + “.png”);
this.suit = suit;
this.name = name;
this.value = value;
this.rank = rank;
this.faceDown = false;
}

public boolean isFaceDown() {
return this.faceDown;
}

public void setFaceDown(boolean faceDown) {
this.faceDown = faceDown;
}

public String getSuit() {
return this.suit;
}

public String getName() {
return this.name;
}

public int getValue() {
return this.value;
}

public int getRank() {
return this.rank;
}


public String toString() {
if (this.faceDown) {
return “<HIDDEN CARD>”;
} else {
return “<” + this.suit + " " + this.name + “>”;
}
}

public String display() {
return “<”+this.suit+" “+this.name+” “+this.rank+”>";
}
}
//card rank
// D C H S
//1 1 2 3 4
//2 5 6 7 8
//3 9 10 11 12
//4 13 14 15 16
//5 17 18 19 20
//6 21 22 23 24
//7 25 26 27 28
//8 29 30 31 32
//9 33 34 35 36
//10 37 38 39 40
//J 41 42 43 44
//Q 45 46 47 48
//K 49 50 51 52
package Model;
import java.util.;

public class Dealer extends Player {

private Deck deck;

public Dealer() {
super(“Dealer”, “”, 0);
deck = new Deck();
}

public void shuffleCards() {
System.out.println(“Dealer shuffle deck”);
deck.shuffle();
}

public void dealCardTo(Player player) {
Card card = deck.dealCard(); // take a card out from the deck
player.addCard(card); // pass the card into the player
}

public void addCardsBackToDeck(ArrayList<Card> cards) {
deck.appendCard(cards);
}

//return 1 if card1 rank higher, else return 2
public int determineWhichCardRankHigher(Card card1, Card card2) {
if(card1.getRank()>card2.getRank()) {
return 1;
}else {
return 2;
}
}



}

package Model;
import java.util.;

public class Deck {

private ArrayList<Card> cards;

public Deck() {
cards = new ArrayList<Card>();
String[] suits = { “Diamond”, “Club”,“Heart”,“Spade”, };
for (int i = 0; i < suits.length; i++) {
String suit = suits[i];
Card card = new Card(suit, “Ace”, 1,1+i);
cards.add(card);

int c = 5;
for (int n = 2; n <= 10; n++) {
Card oCard = new Card(suit, “” + n, n,c+i);
cards.add(oCard);
c+=4;
}

Card jackCard = new Card(suit, “Jack”, 10,41+i);
cards.add(jackCard);

Card queenCard = new Card(suit, “Queen”, 10,45+i);
cards.add(queenCard);

Card kingCard = new Card(suit, “King”, 10,49+i);
cards.add(kingCard);
}
}

public Card dealCard() {
return cards.remove(0);
}

//add back one card
public void appendCard(Card card) {
cards.add(card);
}
//add back arraylist of cards
public void appendCard(ArrayList<Card> cards) {
for(Card card: cards) {
this.cards.add(card);
}
}

public void shuffle() {
Random random = new Random();
for(int i=0;i<10000;i++) {
int indexA = random.nextInt(cards.size());
int indexB = random.nextInt(cards.size());
Card cardA = cards.get(indexA);
Card cardB = cards.get(indexB);
cards.set(indexA, cardB);
cards.set(indexB, cardA);
}
}

//for internal use only
private void showCards() {
for (Card card : cards) {
System.out.println(card);
}
}

//for internal use only
private void displayCards() {
for (Card card : cards) {
System.out.println(card.display());
}
}

public static void main(String[] args) {
Deck deck = new Deck();
//deck.shuffle();
/Card card1 = deck.dealCard();
Card card2 = deck.dealCard();
Card card3 = deck.dealCard();
deck.showCards();

ArrayList<Card> cards = new ArrayList<Card>();
cards.add(card1);
cards.add(card2);
cards.add(card3);
deck.appendCard(cards);
System.out.println();/
deck.displayCards();
}
}

//card rank
//D C H S
//1 1 2 3 4
//2 5 6 7 8
//3 9 10 11 12
//4 13 14 15 16
//5 17 18 19 20
//6 21 22 23 24
//7 25 26 27 28
//8 29 30 31 32
//9 33 34 35 36
//10 37 38 39 40
//J 41 42 43 44
//Q 45 46 47 48
//K 49 50 51 52
package Model;
import java.util.;

public class Player extends User{

private int chips;
protected ArrayList<Card> cardsOnHand;

public Player(String loginName, String password, int chips) {
super(loginName, password);
this.chips = chips;
this.cardsOnHand = new ArrayList<Card>();
}

public int getChips() {
return this.chips;
}

public void addChips(int amount) {
this.chips+=amount;//no error check
}

public void deductChips(int amount) {
this.chips-=amount;//no error check
}

public void addCard(Card card) {
this.cardsOnHand.add(card);
}

public ArrayList<Card> getCardsOnHand() {
return this.cardsOnHand;
}


public int getTotalCardsValue() {
int total = 0;
for(Card card: this.cardsOnHand) {
total+=card.getValue();
}
return total;
}


public Card getLastCard() {
return this.cardsOnHand.get(this.cardsOnHand.size()-1);
}

public void clearCardsOnHand() {
this.cardsOnHand.clear();
}

//Think of the action that a player can take
//implement more related methods here
public static void main(String[] args) {
// TODO Auto-generated method stub
Player player = new Player(“IcePeak”,“A”,100);
System.out.println(player.getChips());
player.deductChips(10);
System.out.println(player.getChips());
player.addChips(20);
System.out.println(player.getChips());
}
}
package Model;
import Helper.;

abstract public class User {

private String loginName;
private String hashPassword;

public User(String loginName, String password) {
this.loginName = loginName;
this.hashPassword = Utility.getHash(password);
}

public String getLoginName() {
return this.loginName;
}

public boolean checkPassword(String password) {
return this.hashPassword.equals(Utility.getHash(password));
}
}
package View;

import Helper.Keyboard;
import Model.*;

//all input and output should be done view ViewController
//so that it is easier to implement GUI later
public class ViewController {

public void displayExitGame() {
System.out.println(“Thank you for playing HighSum game”);
}


public void displayBetOntable(int bet) {
System.out.println(“Bet on table : “+bet);
}

public void displayPlayerWin(Player player) {
System.out.println(player.getLoginName()+” Wins!”);
}

public void displayDealerWin() {
System.out.println(“Dealer Wins!”);
}

public void displayTie() {
System.out.println(“It is a tie!.”);
}

public void displayPlayerQuit() {
System.out.println(“You have quit the current game.”);
}

public void displayPlayerCardsOnHand(Player player) {
System.out.println(player.getLoginName());

if(player instanceof Dealer) {
for (int i = 0; i < player.getCardsOnHand().size(); i++) {
if (i == 0) {
System.out.print(”<HIDDEN CARD> “);
} else {
System.out.print(player.getCardsOnHand().get(i).toString() + " “);
}
}
} else {
for (Card card : player.getCardsOnHand()) {
System.out.print(card + " “);
}
}
System.out.println();
}

public void displayBlankLine() {
System.out.println();
}

public void displayPlayerTotalCardValue(Player player) {
System.out.println(“Value:”+player.getTotalCardsValue());
}

public void displayDealerDealCardsAndGameRound(int round) {
System.out.println(“Dealer dealing cards - ROUND “+round);
}

public void displayGameStart() {
System.out.println(“Game starts - Dealer shuffle deck”);
}

public void displayPlayerNameAndChips(Player player) {
System.out.println(player.getLoginName()+”, You have “+player.getChips()+” chips”);
}

public void displayPlayerNameAndLeftOverChips(Player player) {
System.out.println(player.getLoginName()+”, You are left with “+player.getChips()+” chips”);
}

public void displayGameTitle() {
System.out.println(“HighSum GAME”);
}

public void displaySingleLine() {
for(int i=0;i<30;i++) {
System.out.print(”-“);
}
System.out.println();
}

public void displayDoubleLine() {
for(int i=0;i<30;i++) {
System.out.print(”=“);
}
System.out.println();
}


public char getPlayerCallOrQuit() {
char[] choices = {‘c’,‘q’};
char r = Keyboard.readChar(“Do you want to [c]all or [q]uit?:”,choices);
return r;
}

public char getPlayerFollowOrNot(Player player, int dealerBet) {

boolean validChoice = false;
char[] choices = {‘y’,‘n’};

char r = ‘n’;
while(!validChoice) {
r = Keyboard.readChar(“Do you want to follow?”,choices);
//check if player has enff chips to follow
if(r==‘y’ && player.getChips()<dealerBet) {
System.out.println(“You do not have enough chips to follow”);
displayPlayerNameAndChips(player);
}else {
validChoice = true;
}
}
return r;
}

public char getPlayerNextGame() {
char[] choices = {‘y’,‘n’};
char r = Keyboard.readChar(“Next game?”,choices);
return r;
}

public int getPlayerCallBetChip(Player player) {
boolean validBetAmount = false;
int chipsToBet = 0;
while(!validBetAmount) {
chipsToBet = Keyboard.readInt(“Player call, state bet:”);
if(chipsToBet<0) {
System.out.println(“Chips cannot be negative”);
}else if(chipsToBet>player.getChips()) {
System.out.println(“You do not have enough chips”);
}else {
validBetAmount = true;
}
}
return chipsToBet;
}

public int getDealerCallBetChips() {
System.out.println(“Dealer call, state bet: 10”);
return 10;
}


}

”

These are the requirements:
“On completion of this assignment a student should be able to write a Java application that: • Makes use of Java API “Swing” and “AWT” packages • Handles generated events • Makes use of layout manager to organize the GUI components • Know how to apply and design a program using object-oriented concepts 2. Task Enhance the one player Java game application “HighSum” done in Assignment 1 with Graphical User Interface (GUI). 2.1 Login The game starts by the player logging into the game. Page 2 Copyright SCIT, University of Wollongong, 2023 2.2 Play Game The game starts after the player click on “Login”. First, the dealer will shuffles the deck. (You may include animation in this frame to simulate “shuffle” effect as enhancement.) Then the dealer deals two cards from the top of the deck to the player and itself. Since the player’s last card is higher than the dealer’s last card, the player gets to Call the game. Assume the player states 10 as the bet chips. The player’s chip will be deducted by 10. Page 3 Copyright SCIT, University of Wollongong, 2023 The chips on table will be updated to 20 and the dealer deals cards for next round. Assume the dealer’s last card is higher than the player’s last card. The dealer Call the game and the player gets to choose to Follow or Quit the game. If the player follows the game, 10 chips will be deducted from the player’s balance chips. (Asumme the dealer place 10 chips.) The games carry on for maximum of four rounds. In the last round, the player with the highest total sum wins the game. And the game continues until the player exits the game."

These are the game logic and rules to follow:
“Game Start
The game starts with the dealer shuffles the deck of cards.
The dealer will deal (distribute) the cards to the players.
The dealer make two passes so that the players and the dealer have two cards each.
Two passes means that the dealer must distribute the cards in such a way that, the first card belongs to the player, the second card belongs to the dealer, the third card belongs to the player and the fourth card belows to the dealer.
Round 1
The first card of the dealer and player are both hidden, that is face down.
The dealer and player can view their own hidden first card.
The second card is visible to both the dealer and player.
The player with the highest second visible card will make a “call” by stating the amount to bet.
The other player will need to place the same amount of bet.
Both the bet amount from dealer and player will be placed on the table.
The dealer is not allowed to quit the game.
Round 2
The dealer make one pass.
Dealer and player each have 3 cards now.
The player with the highest third visible card will make a “call” by stating the amount to bet.
The other player will need to place the same amount of bet or choose to quit the current game.
Dearler is not allowed to quit the game.
If the human player choose to quit at this round, all the chips on the table belongs to the dealer and the current game ends here.
Both the bet amount from dealer and player will be placed on the table.
The dealer is not allowed to quit the game.
Round 3
Similar to round 2.
Round 4
Similar to round 2 plus the following rule:
Each player compares the values of cards hold by other players at the end of each game to determine the winner. The player with the highest accumulate values win the game.
The winner gets all the bet on the table.
Next Game
All the cards on the table are shuffled and placed at the end of the deck.
The game will start again unless the player choose to leave the game.
Please note that the above game description is a simplified version of the real game and there are also many different versions in different countries. The specifications given in this document are more than sufficient for you to complete this assignment. If you have doubts on the game logic, please feel free to clarify with your tutor. Do take note that the emphasis of this assignment is to implement the game logic using Object-oriented programming.”

Edit the code so that when highsum class is run in the ide, there is a gui program which the rules of the game are put in place and the sequence.