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 reflective cross-site scripting attack (like the one in this lab) is a __________ attack in which all input shows output on th
Murrr4er [49]

Answer:

" Non-persistent" is the right response.

Explanation:

  • A cross-site category of screenplay whereby harmful material would have to include a transaction to have been transmitted to that same web application or user's device is a Non-persistent attack.
  • Developers can upload profiles with publicly available information via social media platforms or virtual communication or interaction.
6 0
3 years ago
To ensure rapid recovery and security of data, backup data should be ________.
Nataly [62]

Answer:B kept at a secure location at the facility

Explanation:

8 0
3 years ago
In the line of code shape ("classic") which part of the code is the argument
Mekhanik [1.2K]
Whatever is in the parenthese
5 0
3 years ago
Read 2 more answers
Examine about the Internal & External Fragmentation methods give an example for each. essay​
Tju [1.3M]

Internal Fragmentation occurs when a process needs more space than the size of allotted memory block or use less space. External Fragmentation occurs when a process is removed from the main memory. Internal Fragmentation occurs when Paging is employed. External Fragmentation occurs when Segmentation is employed.

3 0
3 years ago
Write a function that receives a StaticArray where the elements are already in sorted order, and returns a new StaticArray with
Allisa [31]

The code that remove duplicate is as follows:

def remove_duplicate(mylist):

    mylist = list(dict.fromkeys(mylist))

    return mylist

print(remove_duplicate([1, 1, 2, 3, 3, 5, 6, 7]))

<h3>Code explanation</h3>

The code is written in python.

  • we defined a function named "remove_duplicate" and it accept the parameter "mylist".
  • The variable "mylist" is used to store the new value after the duplicate vallues has been removed.
  • Then, wed returned mylist.
  • Finally, we call the function with the print statement . The function takes the required parameter.

learn more on python here: brainly.com/question/21126936

7 0
2 years ago
Other questions:
  • Wendy is an attacker who recently gained access to a vulnerable web server running Microsoft Windows. What command can she use t
    9·1 answer
  • ​You work at a call center of a large bank where you answer credit card services related questions from customers. Lately, you h
    14·1 answer
  • A disadvantage of creating a website with tables, without CSS is
    15·2 answers
  • Indexed sequential access, an index is more useful when the number of record is
    10·1 answer
  • In which step of writing a program does a programmer first use a<br> compiler?<br> documentin
    6·1 answer
  • Radio and television are examples of
    9·1 answer
  • A _____ is a computer that is deliberately set up to be easily hacked into.
    10·1 answer
  • A gui allows you to interact with objects on the screen such as icons and buttons true or false
    15·1 answer
  • Create an application named SalesTransactionDemo that declares several SalesTransaction objects and displays their values and th
    12·1 answer
  • How do u type please help
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!