CSE1IOX Intermediate Object Oriented Programming Assignment

Background:
You are working in a programming role at Greatest Soft an organisation that has a focus on developing mobile games You have been asked to develop the logic for a version of a card game that has aspects similar to the popular card game Uno. The working title for the game is Quattro as it has four players.
CSE1IOX Intermediate Object Oriented Programming Assignment

CSE1IOX Intermediate Object Oriented Programming Assignment

Objectives:
This is an individual assignment Students are not permitted to work in a group when writing this assignment.

Game Materials:
• There are 40 cards in the pack in total
• Cards can be of:
o four different colours – Red, Yellow, Green, Blue; and have
o a number value between 0 – 9
• The game is played with four players.
An example selection of 5 cards could be: Blue 5, Red 7, Green 0, Red 2, Green 5

Rules for Game play :
1.Each player receives a set number of cards to play (for this game players will receive three cards each). These are referred to as the player ‘hand’.
2.The remaining cards are placed in a ‘draw’ pile.
3.The first card in the draw pile is placed in the ‘discard’ pile and its colour and number revealed. It is now the turn of the first player.
4.The first card in the draw pile is placed in the ‘discard’ pile and its colour and number revealed. It is now the turn of the first player.
a. The numbers of the two cards
b. The colours of the two cards
5.If they have a match on colour or number, the player removes the matching card from their hand, and it becomes the first (top) card in the discard pile.
6. If they do not have a match they need to instead take the top card from the draw pile and add it to their hand.
7. Play then moves onto the next player who works their way through steps 4-6
8. Play continues until one player has no cards remaining. This player is declared the winner of the game.

Play continues until one player has no cards remaining. This player is declared the winner of the game.

Also review ‘Sample Game play’ below for a description of how a game may play out

Items to note in relation to the solution:
• This is a text based game only – i.e. you do not have to implement any imagery of cards.
• You can complete the solution however you like, within the following boundaries
o You must use the class structure as outlined in the ‘Class Diagram’ below
o You need to include the functionality as outlined Task 2 below
o You must complete all Tasks below

Class Diagram
You have done some preliminary work and come up with the following class diagram. Note the following in relation to this diagram

• The classes with a ‘blue’ background are active classes in this project. They will contain code for the solution that you are creating
• The classes with an ‘orange’ background are part of a proposed future ‘expansion’ of the game.They need to be implemented but only as a shell (i.e. they will contain no code towards your current solution)

Figure 1 Class Diagram

CSE1IOX Intermediate Object Oriented Programming Assignment

Tasks
Task 1: Program Design
Create a new Net Beans 8.2 Java 8 project called Quattro Test. Add the eight classes from the UML class diagram in a package called ‘quattro test’ as shown below.

Create a class stub for each class such as below:
public class Class Name

Add the necessary additional keywords for classes that inherit from interfaces or abstract classes This should also be done for classes that do not have current functionality (as highlighted in the diagram above)

Task 2: Functionality
It is expected that your solution will implement the following functionality (check ‘Rules for Game play’ under ‘Background’ for more context on the functionality.

Check as well the ‘Suggested Tips for Implementing for Ideas

Functionality to Implement:
• The card game has four players
• Only one of the players is a ‘human’ player (the remaining three players are bots)
• The program will ask for the human player to give their name.
• Bot players should have a name as well. This should be given to them by the program.
• The deck of cards will consist of forty cards in total made up of:

o 10 Blue cards numbered 0-9
o 10 Yellow cards numbered 0-9
o 10 Red cards numbered 0-9
o 10 Green cards numbered 0-9

• The order of any collection of cards must be randomized (i.e. the cards need to be shuffled)
• Each player will be dealt three cards initially from the deck (or ‘draw’ pile)
• The human (and bot) players will be able to view what cards they have in their ‘hand’
• The human (and bot) players will not be able to view of what cards opponents have.
• Once cards have been distributed to players from the draw pile, the first card from this pile is moved to become the first/top card in the ‘discard’ pile.
• A player needs to ‘match’ the top card of the discard pile with a card they have in their hand.
o If they have a matching card, it is selected and is then moved from their hand to become the top card of the discard pile. Play then moves onto the next player
o If they do not have a matching card, the first card from the draw pile needs to be selected and added to their hand. Play then moves onto the next player

CSE1IOX Intermediate Object Oriented Programming Assignment

CSE1IOX Intermediate Object Oriented Programming Assignment

• Each player should have their turn in order
• Once any player has played their last card a message should be displayed indicating that this player is the winner of the game. The game should end at this point.
• The human player should be asked at the start of the game what their name is
• The human player should be provided with the following information during the game where appropriate

o Their name
o What cards they hold in their hand
o What the top card of the discard pile is
o What cards other players played
o If other players had to select a card from the draw pile
o How many cards the other players have in their hands

• The human player should have some means of indicating which card they would like to play via the console
• If the human does not enter details of a valid card to play, they should be advised to enter details again
• If the human does not have a valid card to play, they should be able to indicate this via the console
• If the ‘draw’ pile is exhausted (i.e. there are no more cards in this pile)
o The top card of the ‘discard’ pile should be retained in the ‘discard’ pile
o All other cards in the ‘discard’ pile should be moved to the ‘draw’ pile and randomized (shuffled).

Suggested tips for implementing:
• Give each of the cards a ‘code’ to identify it i.e. Red 5 could be given the code ‘R5’ or even just a number like ‘16’. What matters is that the code is unique. This code could then be used for the human player to indicate which card they would like to play (along with other functionality)

• Consider making use of Arraylists for the following reasons:

o Array lists can have their contents randomized through the function
Collections.shuffle(array list name) available through importing java.util.*

• Use the ‘Quattro Test’ class to run and test your program frequently. It may be that much of the logic that you write for the program ends up in this class.
• Start by creating the deck of cards making use of the ‘Standard Colour Card’ class. As suggested above consider adding the created cards to an array list, and develop logic to move cards between a deck and draw pile as required by the game
• From there, add in a player (Using the Player class), and develop the logic to move cards between the player hand, and the deck and draw piles
• From there add in the logic to manage the three bot players and player turns.
• Note the above are suggestions only – so long as all functionality is included and all directions in Tasks 1-4 are followed you can create the program how you wish.

Task 03 Exceptions
You will need to run some checks on the validity of data been entered. It is expected that the program will throw an exception in the following circumstances:

• If no name is entered for the human player of the game
• If the human player makes an invalid selection when entering details of a card to play

You must have a catch block that catches these exceptions and displays an appropriate error message. (You can use the get Message method of the Throw able class to achieve this).

You do need to manage the exceptions appropriately i.e. the program should alert the user that an exception has occurred, and advise the user how to proceed.

Task 04 – Comments
Ensure you include appropriate comments in your code including:
• Purpose of classes
• Purpose of methods
• Explanatory notes for any potentially confusing items

Task 05: Testing
Testing Tasks

As part of your program implementation you should test to determine how the program performs when the user makes an invalid selection when choosing a card to play (refer Task 03)

1.What is white box testing and how would you use it to test this feature
2.What is black box testing and how would you use it to test this feature.
3.Describe one of the error scenarios that could unfold if a user does enter incorrect data.
4.Design a custom Java Class to represent a custom exception for Q3. Your solution must follow best-practices from Java’s Exception class hierarchy including:
• A default constructor
• A one-time argument with a message
• The get Message() accessor method.

CSE1IOX Intermediate Object Oriented Programming Assignment

CSE1IOX Intermediate Object Oriented Programming Assignment

Note there is no need to implement this custom exception class.

Short Sample Game play
The following is a sample game
• The human is asked what their name is, and enters ‘Joe’
• The program welcomes Jane to the game.
• Joe receives three cards
o Red 6
o Blue 8
o Green 7
• The program advises Joe that the top card of the ‘Discard’ pile is a Green 9.
• Joe enters a code that advises the program that they wish to play the Green 7
• The Green 7 then becomes the top card of the ‘Discard’ Pile
• Player 02, one of the bot players, plays a Green 2 – Joe is advised of this
• Player 03, one of the bot players, plays a Blue 2 – Joe is advised of this
• Player 04 has no valid cards to play and an extra card is added to their hand – Joe is advised of this
• Joe plays the Blue 8 and now only has one card left
• Play continues around until it is Joe’s next turn. The top card on the Discard pile happens now to be a Yellow 6. Joe is advised of this
• Joe plays the final card in their hand, a Red 6, and wins the game.

Extended Sample Game play and Output
The following is sample output of a game followed by explanatory notes

Figure 2 Sample Output- Part 01

CSE1IOX Intermediate Object Oriented Programming Assignment

Figure 3 Sample Output – Part 02

Sample Game Explanatory Notes
• Line 1: Player is asked to enter their name
• Line 3: Player has not entered a valid name and is asked to enter it again
• Line 5: Player has entered their name (Fiona)
• Line 7-10: Details of the cards that Fiona holds (Yellow 5, Red 7 and Blue 3)
• Line 12-13: Details of what the top card on the ‘discard’ pile is (i.e. what card Fiona needs to match against with one of her cards)
• Lines 14-15: Instructions for playing a card.
• Lines 16-17: Details of the card that Fiona has played. Fiona has selected the card with a code number of 14, which is the Blue 3 (The Blue 3 now becomes the top card on the ‘discard’ pile)
• Line 18: Information about how many cards Fiona now has in her hand (having played the Blue 3 the number of cards in her hand drops from 3 to 2)
• Lines 20-30: Information about what is happening with the other players in the game.

o Note that Player 2 has picked up a card on Line 20 (added a card to their hand). This would have been due to the fact that they had no valid card to play.
o Players 3 and Player 4 both have valid cards to play (i.e. they are able to match the top card when it is their turns)
o Note that Fiona is given information about the number of cards that each other player has, but not what these cards actually are i.e. the player can only see the cards in their own hand.

CSE1IOX Intermediate Object Oriented Programming Assignment

• Lines 31-33: A summary of the cards that Fiona has in her hand prior to taking her turn (Yellow 5 and Red 7)
• Lines 35-36: Details of the top card of the ‘discard’ pile (the last card played by Player 4 – Yellow 2)
• Lines 37-41: Details of Fiona’s turn. Fiona has played Yellow 5 (Code 26) and now has one card in hand.
• Lines 42-53: Information about other player turns Player 4 has only 1 card left and is on level terms with Fiona
• Lines 54-56: Detials of the card that Fiona has at the start of their turn (Red 7)
• Lines 57-58: Details of the top card (Yellow 0)
• Lines 59-62: Fiona is unable to match the top card (Yellow 0) with the Red 7 that they have. Fiona enters a Code of 0 to pick up a card.
• Lines 63-67: Details of the cards that Fiona now has (Red 7 and Blue 0. The Blue 0 is the card that has been picked up)
• Lines 66-74: Information about Player 2 and Player 3 turns
• Lines 75-77: Player 4 is able to play their last card. With no more cards Player 4 is declared the winner and the game is over.

ORDER This CSE1IOX Intermediate Object Oriented Programming Assignment NOW And Get Instant Discount

Order Your Assignment
Contact us on WhatsApp Assignment help payment - PayPal



Assignment Help In Australia - Essay Help
69 Kent St Millers Point NSW 2000 Australia
Phone : +61-3-6387-7039

Disclaimer: The papers provided by Assignmenthelpinaustralia.com serve as model papers for research candidates and are not to be submitted 'as is'. These papers are intended to be used for reference purposes only.
Assignmenthelpinaustralia.com only offers consultation and research support and assistance in research design, editing, and statistics.*