CSIT111/811: Java Programming - BlackJoker Game - Assessment Answer

February 26, 2018
Author : Ashley Simons

Solution Code: 1AGFA

Question:Java Programming

This assignment falls under Java which was successfully solved by the assignment writing experts at My Assignment Services AU under assignment help service.

Java Assignment

Assignment Task

Program 1: Play list

You will create a program called MyPlaylist.java that manage your play list of songs. You should first implement the Song and Playlist classes modelled in the following UML classes. You should implement the classes as specified exactly without removing or adding any class members of the classes. All members of the classes are useful and must be used at least once.

Java Programming

Java Programming

You will then create the main program MyPlaylist. The main program has the following interface and functionality as illustrated in the following sample run. You should implement the interface and the functionality in the main method by invoking appropriate methods of the classes modelled in the UML class diagrams. (User input is in red colour, the output of the playlist content

in blue colour and prompt lines in black colour. Highlights in colours in this paper are for readability only.)

$java MyPlaylist

Welcome to my playlist!

1 - Add a new song

2 - List all songs

3 - Display total playtime

4 - exit

Please enter your choice:1

Title of the song:

Closer

Name of the artist:

Chainsmokers

Duration (seconds):

240

1 - Add a new song

2 - List all songs

3 - Display total playtime

4 - exit

Please enter your choice:1

Title of the song:

Heathens

Name of the artist:

Twenty One Pilots

Duration (seconds):

210

1 - Add a new song

2 - List all songs

3 - Display total playtime

4 - exit

Please enter your choice:1

Title of the song:

Cold Water

Name of the artist:

Major Lazer

Duration (seconds):

183

1 - Add a new song

2 - List all songs

3 - Display total playtime

4 - exit

Please enter your choice:2

Title: Closer Artist: Chainsmokers Duration(seconds): 240

Title: Heathens Artist: Twenty One Pilots Duration(seconds): 210

Title: Cold Water Artist: Major Lazer Duration(seconds): 183

1 - Add a new song

2 - List all songs

3 - Display total playtime

4 - exit

Please enter your choice:3

Total play time: 633

1 - Add a new song

2 - List all songs

3 - Display total playtime

4 - exit

Please enter your choice:4

Thank you. Bye!

When you are developing your program, you can run your program as follows to redirect the input

file, input.txt, to the standard input for rapid testing.

$java MyPlaylist < input.txt

You need make sure your program can run properly with the provided input file redirected to the

standard input as above.

Program 2: BlackJoker game

You will create a card game called BlackJoker, which is not Blackjack.

The game:

The cards:

  • The cards have ranks from 2 to 10, J, Q, K and A with suits and the cards may not reappear.
  • The hand values are the sum of card points according to the following table.

Java

Java Programming

The rules:

  • The dealer receives its initial two cards and one card is face up.
  • The player receives its initial two cards
  • If the two initial cards in the hand received by either the dealer or the player are two cards from 10, J, Q, K or A in the same colour, it is called BlackJoker and the hand wins. The player wins a tie.
  • If no one wins with BlackJoker, the game continues.
  • The player makes a decision among two options: “Hit” or “Stand”.
  • If the player hits, it takes another card until it stands.
  • If the player stands, it takes no more cards then the dealer will takes cards.
  • The dealer will take cards until the hand busts or achieves a value of 17 or higher.
  • If either the player or the dealer exceeds 20 points at any time, it busts and loses the game immediately.
  • If no one busts, the hand of higher values wins and the player wins a tie.

    Important Note: You must implement the above rules. If the game plays other rules such as the rules of Blackjack, you will receive 0 mark for this program.

Task 1: Implement Card, CardDeck and Player classes

You should implement all classes modelled in the following UML diagrams. You should implement the classes as specified exactly without removing or adding any class members of the classes. You need analyse the rules of the game and the gameplay as in the sample runs to determine the behaviours of the objects and the semantics of the methods as in the UML diagrams. All members of the classes are useful and must be used at least once. The ranks and suits members of the CardDeck class are used to define the values of card ranks and suits, respectively.

Task 2 (for CSIT111 students): Create a single player BlackJoker program

You will create a single player game in the file BlackJoker.java. You should implement the interface and the rules of the game in the main method by invoking appropriate methods of the classes modelled in Task 1.

Some sample runs of the program are as follows. (User input is in red colour, the card ranks and points in blue colour, prompt lines in black colour and results in green colour. Highlights in colours in this paper are for readability only.)

$java BlackJoker Welcome to the game of BlackJoker!

What's your name? Peter Dealer’s hand: 10d Total: 10 Peter’s hand: Ah 4c Total: 14

Hit(H or h) or Stand(S or s):h Peter’s hand: Ah 4c 5d Total: 19

Hit(H or h) or Stand(S or s):S Dealer’s hand: 10d Ks Total: 20 Dealer wins!

$java BlackJoker Welcome to the game of BlackJoker!

What's your name? John Dealer’s hands: 6h Total: 6 John’s hand: 9d Qc Total: 19 Hit(H or h) or Stand(S or s):s Dealer’s hand: 6h Ah Jd Total: 26 Dealer busts!

$java BlackJoker Welcome to the game of BlackJoker!

What's your name? Peter Dealer's hand: 6s Total: 6 Peter's hand: Qh Jh Total: 20 Dealer's hand: 6s 9h Total: 15 Peter has BlackJoker! Peter wins

$java BlackJoker Welcome to the game of BlackJoker!

What's your name? Peter Dealer's hand: Ad Total: 10 Peter's hand: 8h 3h Total: 11 Dealer's hand: Ad Qh Total: 20 Dealer has BlackJoker! The dealer wins

$java BlackJoker Welcome to the game of BlackJoker!

What's your name? Bob Dealer’s hand: 2s Total: 2 Bob’s hand: 9d 3c Total: 12

Hit(H or h) or Stand(S or s):H Bob’s hand: 9d 3c Qs Total: 22 Bob busts!

Task 2 (for CSIT811 students): Create a multiplayer BlackJoker program

The extended rules for multiplayer games:

The multiplayer game follows all the rules specified in The rules section and the following extensions:

  • All players play the game in sequence one after another after previous player stands;
  • The game will continue unless all players have BlackJoker;
  • If the dealer has BlackJoker, the dealer wins except players who have BlackJoker as well;
  • If a player busts, it loses immediately;

You will create a multiplayer game in the file BlackJoker.java. You should implement the interface and these rules of the game in the main method by invoking appropriate methods of the classes modelled in Task 1.

Your program should first take the number of players and all players’ name at the beginning as follows:

How many players? 2 Player 1's your name? Peter Player 2's your name? John

Then display the dealer’s first card before each player plays the game. After all players finish their game, display the final results of all players who have not busted as follows:

Dealer's hand: 9s 9h Total: 18

Peter's hand: Qh Js Total: 20 Peter wins

John’s hand: 2d Qc Total: 12 Dealer wins!

The assignment file was solved by professionalJava experts and academic professionals at My Assignment Services AU. The solution file, as per the marking rubric, is of high quality and 100% original (as reported by Plagiarism). The assignment help was delivered to the student within the 2-3 days to submission.

Looking for a new solution for this exact same question? Our assignment help professionals can help you with that. With a clientele based in top Australian universities, My Assignment Services AU’s assignment writing service is aiding thousands of students to achieve good scores in their academics. OurJava assignment experts are proficient with following the marking rubric and adhering to the referencing style guidelines.

Solution:

Java

Java

ThisJava assignment sample was powered by the Javaassignment writing experts of My Assignment Services AU. You can free download thisJava assessment answer for reference. This solvedJava assignment sample is only for reference purpose and not to be submitted to your university. For a fresh solution to this question, fill the form here and get our professional assignment help.

RELATED SOLUTIONS

Order Now

Request Callback

Tap to ChatGet instant assignment help

Get 500 Words FREE