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
A _____ is a member function that is automatically called when a class object is created.
Salsk061 [2.6K]
Constructor. It initializes the object, usually assigning the variables passed to the new statement into variables in the objects namespace.
6 0
3 years ago
¿Es aquel panel que controla la estructura de la tabla dinámica?
blondinia [14]

Answer:

PARTES DE UNA TABLA DINÁMICA

Una vez que has aprendido cómo crear una tabla dinámica en Excel es conveniente detenerse un momento para conocer las partes que la componen y comprender el funcionamiento de cada una de ellas.

PARTES DE UNA TABLA DINÁMICA EN EXCEL

Justo cuando se ha creado una tabla dinámica se muestra en la parte derecha de la hoja la lista de campos disponibles y por debajo las áreas donde podemos arrastrar dichos campos. Estas áreas denotan cada una de las partes de una tabla dinámica.

Explanation:

hope it helps you

8 0
2 years ago
Read 2 more answers
Which statement describes Augmented Reality (AR) technology?
anyanavicka [17]

Answer:

Augmented Reality (AR) superimposes images and audio over the real world in real time. It does allow ambient light and does not require headsets all the time.

yan po ang szgot

<em>wala</em><em> </em><em>po</em><em> </em><em>kasi</em><em> </em><em>pagp</em><em>i</em><em>p</em><em>ilian</em><em> </em>

<em>HOPE</em><em> </em><em>IT</em><em> </em><em>HELPS</em><em> </em>

<em>pls</em><em> </em><em>follow</em><em> </em><em>ke</em><em /><em /><em />

3 0
3 years ago
A web ______ is a computer that delivers requested webpages to your computer or mobile device.
Goshia [24]
I believe that the answer you are looking for is a Web Server.
7 0
3 years ago
Which of the following bit patterns represents the value -9 in two’s complement notation?
nadya68 [22]

Answer:

B. 11110111

Explanation:

Binary representation of number 9 = 00001001

Binary representation of -9 would involve calculating the twos complement representation of 00001001

First we compute the ones complement of this number by reversing the bits.

00001001 => 11110110

Next we calculate the twos complement representation by adding 1 to the ones complement.

11110110+1 = 11110111

So the final representation is 11110111.

5 0
3 years ago
Other questions:
  • What is the use of pecil icon
    11·2 answers
  • . Reorder the following efficiencies from smallest to largest:
    9·1 answer
  • Univariate linear regression Note: Solutions to this problem must follow the method described in class and the linear regression
    7·1 answer
  • Describe one type of technology that is useful in producing images from space.
    9·1 answer
  • Digital libraries are often available to students and/or employees at colleges, schools, and BLANK institutions.
    15·1 answer
  • Match the keyboard shortcuts to the function they perform
    10·1 answer
  • 120
    14·1 answer
  • MORE FREEE POINTS AYEEE
    7·2 answers
  • FoRWarD MaRcH AND hERe We Go MEMbers of the agEncy BaKuGO AHHHHHHHHH-
    10·2 answers
  • What is the simplest form of backing up data?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!