subject

Hello! I need help with what I should put in my program. cs to test out my code. (my code is below) What method and code do I write to test it out? Thanks!

namespace DES1_Week1_PlayingCardAssignment
{

public enum Ranks {
Ace = 1,
Two,
Three,
Four,
Five,
Six,
Seven,
Eight,
Nine,
Ten,
Jack,
Queen,
King,
NUM_RANKS
}

public enum Suits {
Hearts = 0,
Diamonds,
Spades,
Clubs,
NUM_SUITS
}

class PlayingCard {
private Suits Suit;
private Ranks Rank;

public PlayingCard(Suits NewSuit, Ranks NewRank) {
Suit = NewSuit;
Rank = NewRank;
}

public static int CompareCards(PlayingCard Card1, PlayingCard Card2) {
int diff = Card2.GetValue() - Card1.GetValue();
if (diff > 0) {
return 1;
} else if (diff < 0) {
return -1;
} else {
return 0;
}
}

public Suits GetSuit() {
return Suit;
}

public Ranks GetRank() {
return Rank;
}

public int GetValue() {
if (Rank == Ranks. Ace) {
return 11;
} else if (Rank == Ranks. King || Rank == Ranks. Queen || Rank == Ranks. Jack) {
return 10;
} else {
return (int)Rank;
}
}

public void (int XPosition, int YPosition) {
char symbol;
if (Suit == Suits. Clubs) {
symbol = ClubSymbol;
} else if (Suit == Suits. Diamonds) {
symbol = DiamondSymbol;
} else if (Suit == Suits. Hearts) {
symbol = HeartSymbol;
} else {
symbol = SpadeSymbol;
}
Console. SetCursorPosition(XPosition, YPosition++);
char[] values = new char[]{ 'A', '2', '3', '4', '5', '6', '7', '8', '9', 'J', 'K', 'Q' };
char value = values[((int)Rank) - 1];
for (int y = 0; y < CardHeight; y++) {
for (int x = 0; x < CardWidth; x++) {
if (x == 0 && y == 0) {
Console. Write("╔");
} else if (x == CardWidth - 1 && y == 0) {
Console. WriteLine("╗");
} else if (x == 0 && y == CardHeight - 1) {
Console. Write("╚");
} else if (x == CardWidth - 1 && y == CardHeight - 1) {
Console. WriteLine("╝");
} else if (x == 0) {
Console. Write("║");
} else if (x == CardWidth - 1) {
Console. WriteLine("║");
} else if ((y == 0 || y == CardHeight - 1) && (x > 0 && x < CardWidth)) {
Console. Write("═");
} else if (x == 1 && y == 1 || (x == CardWidth - 2 && y == CardHeight - 2)) {
Console. Write(value);
} else if (x == CardWidth / 2 && y == CardHeight / 2) {
Console. Write(symbol);
} else {
Console. Write(" ");
}
}
Console. SetCursorPosition(XPosition, YPosition++);
}
}

public int GetAltValue() {
if (Rank == Ranks. Ace) {
return 1;
} else if (Rank == Ranks. King || Rank == Ranks. Queen || Rank == Ranks. Jack) {
return 10;
} else {
return (int)Rank;
}
}

private static char HeartSymbol = Encoding. GetEncoding(437).GetChars(new byte[] { 3 })[0];
private static char DiamondSymbol = Encoding. GetEncoding(437).GetChars(new byte[] { 4 })[0];
private static char ClubSymbol = Encoding. GetEncoding(437).GetChars(new byte[] { 5 })[0];
private static char SpadeSymbol = Encoding. GetEncoding(437).GetChars(new byte[] { 6 })[0];
public static int CardWidth = 5;
public static int CardHeight = 3;

}
}

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 20:30, cristalcastro901
If an appliance consumes 500 w of power and is left on for 5 hours, how much energy is used over this time period? a. 2.5 kwh b. 25 kwh c. 250 kwh d. 2500 kwh
Answers: 1
image
Computers and Technology, 24.06.2019 01:00, gymnast8900
Me if you do then you get 10 points and brainliest
Answers: 1
image
Computers and Technology, 24.06.2019 02:00, arubright177
Write an expression that will cause the following code to print "equal" if the value of sensorreading is "close enough" to targetvalue. otherwise, print "not equal". ex: if targetvalue is 0.3333 and sensorreading is (1.0/3.0), output is:
Answers: 1
image
Computers and Technology, 24.06.2019 10:20, silviamgarcia
Write a program that keeps asking the user for new values to be added to a list until the user enters 'exit' ('exit' should not be added to the list). these values entered by the user are added to a list we call 'initial_list'. then write a function that takes this initial_list as input and returns another list with 3 copies of every value in the initial_list. finally, inside print out all of the values in the new list. for example: input: enter value to be added to list: a enter value to be added to list: b enter value to be added to list: c enter value to be added to list: exit output: a b c a b c a b c note how 'exit' is not added to the list. also, your program needs to be able to handle any variation of 'exit' such as 'exit', 'exit' etc. and treat them all as 'exit'.
Answers: 2
You know the right answer?
Hello! I need help with what I should put in my program. cs to test out my code. (my code is below)...

Questions in other subjects: