he CODE Must be in JAVA. Please show in simplest form and with comments. Please show the outputs as well (Minimum 2) public class Card{ int faceValue; int suit; Card(){ this.faceValue = 9; this.suit = 1; } Card(int f,int s){ this.faceValue = f; this.suit = s; } String getfaceValue(){ if(this.faceValue==1) return "Ace"; else if(this.faceValue==2) return "Two"; else if(this.faceValue==3) return "Three"; else if(this.faceValue==4) return "Four"; else if(this.faceValue==5) return "Five"; else if(this.faceValue==6) return "Six"; else if(this.faceValue==7) return "Seven"; else if(this.faceValue==8) return "Eight"; else if(this.faceValue==9) return "Nine"; else if(this.faceValue==10) return "Ten"; else if(this.faceValue==11) return "Jack"; else if(this.faceValue==12) return "Queen"; else if(this.faceValue==13) return "King"; else return "Inavlid"; } String getSuit(){ if(this.suit==1) return "Spades"; else if(this.suit==2) return "Hearts"; else if(this.suit==3) return "Clubs"; else if(this.suit==4) return "Diamonds"; else return "Invalid"; } void setfaceValue(int s){ this.faceValue = s; } void setSuit(int s){ this.suit=s; } public String toString(){ return getfaceValue()+" of "+getSuit(); } } //Test Driver for the Card public class TestDriver{ public static void main(String[] args) { Card c1 = new Card(1,1); System.out.println(c1); } }
The CODE Must be in JAVA. Please show in simplest form and with comments. Please show the outputs as well (Minimum 2)
public class Card{
int faceValue;
int suit;
Card(){
this.faceValue = 9;
this.suit = 1;
}
Card(int f,int s){
this.faceValue = f;
this.suit = s;
}
String getfaceValue(){
if(this.faceValue==1)
return "Ace";
else if(this.faceValue==2)
return "Two";
else if(this.faceValue==3)
return "Three";
else if(this.faceValue==4)
return "Four";
else if(this.faceValue==5)
return "Five";
else if(this.faceValue==6)
return "Six";
else if(this.faceValue==7)
return "Seven";
else if(this.faceValue==8)
return "Eight";
else if(this.faceValue==9)
return "Nine";
else if(this.faceValue==10)
return "Ten";
else if(this.faceValue==11)
return "Jack";
else if(this.faceValue==12)
return "Queen";
else if(this.faceValue==13)
return "King";
else
return "Inavlid";
}
String getSuit(){
if(this.suit==1)
return "Spades";
else if(this.suit==2)
return "Hearts";
else if(this.suit==3)
return "Clubs";
else if(this.suit==4)
return "Diamonds";
else
return "Invalid";
}
void setfaceValue(int s){
this.faceValue = s;
}
void setSuit(int s){
this.suit=s;
}
public String toString(){
return getfaceValue()+" of "+getSuit();
}
}
//Test Driver for the Card
public class TestDriver{
public static void main(String[] args) {
Card c1 = new Card(1,1);
System.out.println(c1);
}
}
![In Assignment 4, you created a Card class that represents a standard playing card. Use this to design and implement a class called
DeckofCards that stores 52 objects of the Card class using an array. Include methods to shuffle the deck, deal a card, return the number of
cards left in the deck, and a toString to show the contents of the deck. The shuffle methods should assume a full deck. Document your
design with a UML Class diagram. Create a separate driver class that first outputs the populated deck to prove it is complete, shuffles the
deck, and then deals each card from a shuffled deck, displaying each card as it is dealt along with the number of cards left in the deck.
Hint: The constructor for DeckOfCards should have nested for loops for the face values (1 to 13) within the suit values (1 to 4) calling the
two parameter constructor. The shuffle method does not have to simulate how a deck is physically shuffled; you can achieve the same
effect by repeatedly swapping pairs of cards chosen at random.
Testing: Include two complete runs to demonstrate the random effect of shuffling.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Ffec77d62-0696-4a57-8c22-08cd79cf3eb2%2Fc8fd7137-f2b3-4299-a1ef-0d8faaaa0b40%2Fsa6qb1f_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 2 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)