Question: I have a C# This is all one same project. Using classes at least 4 classes, I'm not allowed to use anything but System, and

I have a C# This is all one same project. Using classes at least 4 classes, I'm not allowed to use anything but System, and I'm also not allowed to use inheritance.

1.) Create a deck of cards. 2.) Display your deck of cards. 3.) Randomly shuffle your deck of cards. 4.) Display your shuffled deck of cards. 5.) "Cut (Links to an external site.)Links to an external site." the shuffled deck of cards using a randomly chosen cut point. 6.) Display your cut deck of cards.

This is what I have so far, but I'm really stuck... could someone help me, please?

public enum Ranks { Ace, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Jack, Queen, King }; public enum Suits { Club, Diamond, Heart, Spade }; class Program { static void Main(string[] args) { Console.WriteLine("Hello World!"); Deck D = new Deck(); D.Shuffle(); for (int i = 0; i < 52; i++) { Console.Write("{0, -19}", D.DealCard()); if ((i + 1) % 4 == 0) Console.WriteLine(); } Console.ReadLine(); //D.Shuffle(); //S.Shuffle(D); // Console.WriteLine(D); } } public class Card { private Suits suit; private Ranks rank; public Card(Ranks rank, Suits suit) { this.suit = suit; this.rank = rank; } public void print() { Console.Write(rank + " of " + suit); } public override string ToString() { return "[" + rank + "of " + suit + "]"; } } public class Deck { private Card[] deck; private int currentCard; private int numberOfCards = 52; public void setUpDeck() { this.deck = new Card[numberOfCards]; int i = 0; currentCard = 0; foreach (Suits s in Enum.GetValues(typeof(Suits))) { foreach (Ranks r in Enum.GetValues(typeof(Ranks))) { deck[i] = new Card(r, s); i++; } }

} }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!