fbpx

PlayingCard and DeckOfCards | Homework Help Websites

In this project you will implement a simple card game using the PlayingCard and DeckOfCards classes you built in the previous two homework assignments. There are several options of varying complexity. Turn in just one of the following options:

Don't use plagiarized sources. Get Your Assignment on
PlayingCard and DeckOfCards | Homework Help Websites
Just from $13/Page
Order Now

(9 out of 15 points) In the simplest version of the game, you will

(12 out of 15 points) In the second version, do the same as above, but do multiple rounds, until the deck is exhausted. Keep track of how many rounds the user and the dealer have each won, and display the final result.

(15 out of 15 points) In the third version, deal the user a card, then ask them to guess whether they or the dealer will win. Deal a card to the dealer and show the user. If their guess is correct, then they score a point, and if their guess is wrong then the dealer wins. Play multiple rounds until the deck is exhausted. Keep track of how many rounds the user and the dealer have each won. Throughout the game, give enough messages to the user so they follow the game and it makes sense to them.

  • package hw17; public class DeckOfCard { private PlayingCard [] deck = new PlayingCard[52]; private int cardDealt = 0; private String [] s = new String[52]; private int cardRemained = 52; public DeckOfCard() { for(int i =0; i<13; i++) { for(int j =0;j<4;j++) { deck[i*4+j] = new PlayingCard(i+1,j+1); } } } public PlayingCard dealNextCard() { PlayingCard b = deck[cardDealt]; cardDealt += 1; return b; } public int cardsRemaining() { cardRemained -= cardDealt; return cardRemained; } private void swap(int a, int b) { PlayingCard temp; temp = deck[a]; deck[a] = deck[b]; deck[b] = temp; } public void shuffle() { cardDealt = 0; for(int i=1; i<52; i++) { int index = (int)(Math.random()*52); swap(index,i); } for(int i=0; i<52; i++) { int randomNum = (int)(Math.random()*52); int temp; temp = i; s[i] = s[randomNum]; s[randomNum] = s[temp]; } } public String toString() { String arrayS = ” “; for(int i=0; i<52;i++) { s[i] = deck[i].toString(); arrayS += s[i]+”\n”; } return arrayS; } }

package hw17; public class PlayingCard { private int value; private int suit; public PlayingCard() { value = (int)(Math.random()*13+1); suit = (int)(Math.random()*4+1); } public PlayingCard(int v, int s) { this.value =v; this.suit =s; } public String toString() { String s; switch(this.value) { case 1: s= “Ace”; break; case 2: s= “2”; break; case 3: s= “3”; break; case 4: s= “4”; break; case 5: s= “5”; break; case 6: s= “6”; break; case 7: s= “7”; break; case 8: s= “8”; break; case 9: s= “9”; break; case 10: s= ” 10″; break; case 11: s= “J”; break; case 12: s=”Q”; break; case 13: s= “K” ; break; default: s = “invalid value”; break; } switch(this.suit){ case 1: s = s + ” of Clubs”; break; case 2: s= s + ” of Diamonds”; break; case 3: s =s + ” of Hearts”; break; case 4: s=s + ” of Spades”; break; default: s = s + “of ” +” invalid number”; break; } return s; } public int getValue() { return this.value; } public int getSuit() { return this.suit; } }

Calculate the price
Make an order in advance and get the best price
Pages (550 words)
$0.00
*Price with a welcome 15% discount applied.
Pro tip: If you want to save more money and pay the lowest price, you need to set a more extended deadline.
We know how difficult it is to be a student these days. That's why our prices are one of the most affordable on the market, and there are no hidden fees.

Instead, we offer bonuses, discounts, and free services to make your experience outstanding.
How it works
Receive a 100% original paper that will pass Turnitin from a top essay writing service
step 1
Upload your instructions
Fill out the order form and provide paper details. You can even attach screenshots or add additional instructions later. If something is not clear or missing, the writer will contact you for clarification.
Pro service tips
How to get the most out of your experience with Homework Writing Services
One writer throughout the entire course
If you like the writer, you can hire them again. Just copy & paste their ID on the order form ("Preferred Writer's ID" field). This way, your vocabulary will be uniform, and the writer will be aware of your needs.
The same paper from different writers
You can order essay or any other work from two different writers to choose the best one or give another version to a friend. This can be done through the add-on "Same paper from another writer."
Copy of sources used by the writer
Our college essay writers work with ScienceDirect and other databases. They can send you articles or materials used in PDF or through screenshots. Just tick the "Copy of sources" field on the order form.
Testimonials
See why 20k+ students have chosen us as their sole writing assistance provider
Check out the latest reviews and opinions submitted by real customers worldwide and make an informed decision.
Entertainment & Gaming
Commendable.
Customer 452441, April 29th, 2022
Human Resources Management (HRM)
Good job.
Customer 462499, June 11th, 2022
Other
thank you very much
Customer 462327, September 22nd, 2022
Social Work and Human Services
Good work.
Customer 460073, June 23rd, 2022
Accounting
the first time around paper was very poor and plagiarized according to grammaly with the help of online support it was reassigned and improved greatly
Customer 453819, February 20th, 2020
Social Sciences
None
Customer 453751, June 14th, 2020
Accounting
Thank you for the revision! This is how it should look like.
Customer 463407, October 16th, 2022
Military
good job
Customer 456821, October 8th, 2022
History
The work is of really good quality and was done on time.
Customer 454439, June 1st, 2020
Business and administrative studies
It met expectations. Thanks!
Customer 463143, September 7th, 2022
Discrete Mathmatics
Be keen on instructions.
Customer 462387, March 30th, 2022
Business and administrative studies
Good work.
Customer 458115, April 27th, 2022
11,595
Customer reviews in total
96%
Current satisfaction rate
3 pages
Average paper length
37%
Customers referred by a friend
OUR GIFT TO YOU
15% OFF your first order
Use a coupon FIRST15 and enjoy expert help with any task at the most affordable price.
Claim my 15% OFF Order in Chat