1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
marysya [2.9K]
3 years ago
12

Create a Card class that represents a playing card. It should have an int instance variable named rank and a char variable named

suit. Give it a constructor with two parameters for initializing the two instance variables and give it a getSuit() method and a getRank() method that return the values of the two instance variables. Then create a CardTester class with a main method that creates five Cards that make up a full house (that is, three of the cards have the same rank and the other two cards have the same rank) and prints out the ranks and suits of the five Cards using the getSuit() and getRank) methods
Computers and Technology
1 answer:
Helen [10]3 years ago
3 0

Answer:

Explanation:

The following code is written in Java. It creates the Card class and then uses it to create a full house and print out the rank and suit of every card in that hand.

class Card {

   int rank;

   char suit;

   public Card(int rank, char suit) {

       this.rank = rank;

       this.suit = suit;

   }

   public int getRank() {

       return rank;

   }

   public char getSuit() {

       return suit;

   }

}

class CardTester {

   public static void main(String[] args) {

       Card card1 = new Card(3, '♥');

       Card card2 = new Card(3, '♠');

       Card card3 = new Card(3, '♦');

       Card card4 = new Card(2, '♦');

       Card card5 = new Card(2, '♣');

       System.out.println("Card 1: " + card1.getRank() + " of " + card1.getSuit());

       System.out.println("Card 2: " + card2.getRank() + " of " + card2.getSuit());

       System.out.println("Card 3: " + card3.getRank() + " of " + card3.getSuit());

       System.out.println("Card 4: " + card4.getRank() + " of " + card4.getSuit());

       System.out.println("Card 5: " + card5.getRank() + " of " + card5.getSuit());

   }

}

You might be interested in
If you schedule a message to be delivered at 6 p.m., but you log out of your computer at 5 p.m., what will happen to the message
valentinak56 [21]

Answer: It will be delivered when you log back in.

Explanation:

It will be delivered when you log back in.

8 0
2 years ago
PLEASE HELP QUICK ASAP NO LINKS PYTHON CODING
Mademuasel [1]

Answer:

its for the movement

Explanation:

6 0
3 years ago
Read 2 more answers
Which practice is the best option for desktop security?
ziro4ka [17]
You should make a unique password and change it daily
6 0
3 years ago
Read 2 more answers
The software that controls the computer hardware and establishes standards for developing and executing applications best descri
victus00 [196]
An operating system such as windows or macos
4 0
4 years ago
The larget social networking site to date is
maks197457 [2]
FB, I would guess.

Sincerely,

Xeno
3 0
3 years ago
Other questions:
  • Which mode can students use to ensure that their information is not saved in their Chrome browser
    15·1 answer
  • When using powershell, an administrator can use the ____________ cmdlet to create a new dc in a new forest.??
    14·1 answer
  • In the windows firewall, any rules preceded by a __________ checkmark have not been enabled. black gray green red
    13·1 answer
  • What is a Joint Staff approved, standardized communications link that is suitable for the transmission of digital information an
    5·1 answer
  • 01000111 01110101 01100101 01110011 01110011 00100000 01110111 01101000 01100001 01110100 00111111
    13·1 answer
  • Certain high-performance vehicles use a dry sump system because it allows for A. more power. B. longer periods of cornering and
    10·2 answers
  • What is the missing line of code?
    13·1 answer
  • Hoda needs to create a chart that is associated with an Excel spreadsheet. She needs to ensure that if the data in the spreadshe
    12·1 answer
  • How to make a computer
    14·2 answers
  • Ways on how to conserve energy.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!