1. Engineering
  2. Computer Science
  3. in java 80 or greater thanks...

Question: in java 80 or greater thanks...

Question details

2.2 Card (15 marks) You must implement the class Card. . An object of the class Card stores a suit and a rank, both of type int. . The class declares one constructor. It receives the initial value for the suit and the rank as parameters. . Each object has two getters, getSuit and getRank, which returns the value of the suit and the rank, respectively . An object of the class Card has a method equals with a parameter of type Object. If the object designated by the parameter is not of type Card, the method returns false, as these objects cannot be considered equals Otherwise, the method returns true if and only if the object designated by parameter is a Card that has the same suit and the same rank. Here is a starting point for your implementation: public boolean equals (Object object) if (object instanceof Card)) [ return false Card other other (Card object 10 I1 Complete the implementation e The method tostring returns a string with the suit and the rank of this card. In order to keep the representation compact when printing an entire deck of cards, no other information than the suit and the rank is used. See below Finally, the class Card declares four constants: DIAMOND, CLUB, HEART, and SPADE, with values 0, 1, 2, and 3, respectively Here is a small example showing the intended use 1 Card a, b : 2 anew Card (2. 7) 3 bnew Card (2. 7); 4 c new Card (0. 9); 5 System. out. println (a): 6 System out. printn (a. equals (b)) 7 System. out. println (a.equals (c)): (2,7) true false 3

in java 8.0 or greater thanks

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution