Pick a card

This is part of coding a game that rolls a die and then picks a card. The combination of the die and the card determines how many points the player gets on that turn. The die is a random # between 1 and 6 and the card correlates to a random number between 0 and 3.

Create a pickACard method that takes in an integer of the die and the card. Based on those 2 numbers, it should print one of 4 things and return the following output: (That returned number will determine the number of points the player will get.)

The main method will get the 2 random numbers and call your pickACard method, passing it those 2 numbers. Then, it will print the number of points the player gets for the turn. (Extra: make it loop and take 5 turns and total the number of points.)

Write a test case class with at least 5 tests of the pickACard method. For example, t.checkExact(pickACard(4,3),4) // meaning that calling pickACard with a 4 and 3 will mean that the card is a 3, which should return whatever the die is, and the die (first parameter) was 4.

die
card
print
output
x
0
lose 1 point
-1
x
1
Nothing Happened
0
x
2
Get one point
1
x
3
Your lucky day!! Get as many points as you rolled
x

 

Note: This is best coded with an if / else if / else structure.

When you are done you will have :

1) A Game class containing a main method and a pickACard method.

2) A test class containg 5 tests for the pickACard method

Here are step by step instructions

This does not apply to Fall 2013 Students: Note: If you prefer to do this in fang: It could roll a die and pick a card whenever you bump the card. The card can be a StringSprite