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.Distance sensor<br> b.Programable microcontroller<br> c.Ambient light sensor<br> d.Wi-Fi
Rainbow [258]

D WiFi

It uses wifi to connect to the internet

3 0
3 years ago
Read 2 more answers
Write a Python function prime_generator that takes as argument positive integers s and e (where s
nika2105 [10]

Answer:

def prime_generator(s, e):

   for number in range(s, e+1):      

       if number > 1:

          for i in range(2, number):

              if (number % i) == 0:

                  break

          else:

               print(number)

   

prime_generator(6,17)

Explanation:

I believe you want to ask the prime numbers between s and e.

- Initialize a for loop that iterates from s to e

- Check if the number is greater than 1. If it is, go inside another for loop that iterates from 2 to that number. If the module of that number to any number in range (from 2 to that number) is equal to 0, this means the number is not a prime number. If the module is not equal to zero, then it is a prime number. Print the number

6 0
3 years ago
How impactful were shipping errors on customer questions.
Bumek [7]

Answer:

It's due to damage of goods

7 0
2 years ago
Which of the following is the best reason for including a photograph in a formal business document
Bond [772]

Answer:

The answer is "The reader wants to see how your product looks".

Explanation:

Some information is missing in the question. so, the correct choice can be described as follows:

  • The corporation uses records and reports to transfer facts, statistics, and figures, including explanations for enhancing activities, administration, and sales.  
  • It generally refers to the various documentation, all with various sections and contents.  
  • In the organization's usage of records for correspondence, transaction, and product research, that's why the "reader wants to see how your product looks" is the correct choice.
8 0
3 years ago
Which of the following statements Terminates the program andstops all threads?
Law Incorporation [45]

Answer:

(c) system.exist(1);

Explanation:

system.exist(1); is used for the termination of the program here both option c and d should be correct but in option d there is exit(0) and zero indicates return means program will return but besides zero if there is any non zero number then program will not return and in option c there is a non zero number which means program will not return so option c  system.exist(1); will be the correct option for the termination of program

8 0
3 years ago
Other questions:
  • What makes Group Policy such a powerful tool is its ability to enable security administrators to:_________.
    8·1 answer
  • Blank includes websites that encourage interaction and connection among people ,business and organizations
    13·1 answer
  • An investor is considering in which of two start-up companies to invest. The investor has faith in the industrial organization (
    9·2 answers
  • A technician is configuring a new SOHO multifunction wireless router at a customer’s location to provide network access to sever
    12·1 answer
  • Write the sum of products, the canonical product of sums, theminterm shorthand and the maxterm shorthand for the following:
    6·1 answer
  • What is the long tube on a microscope called​
    15·1 answer
  • Which is the best choice to explain why a human resource manager is so
    5·1 answer
  • WHO WANT P O I N T S.................................................
    9·1 answer
  • A Product Manager has been given responsibility for overseeing the development of a new software application that will be deploy
    5·1 answer
  • When you try to move the desktop icon using the click and drag method and it doesn't move, what is the reason?​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!