1. Engineering
  2. Computer Science
  3. gt5w assignrren gtmcg1100wa o how lo make d...

Question: gt5w assignrren gtmcg1100wa o how lo make d...

Question details

€>5W Assignrren × €>MCG1100-wa × O how lo make d Χ €> Assignmen11- ㄨ 血 index.pdf X Arrays ← → C ǐ https://www.eecs.uottawa.ca/-turcotte/teachingiti-1 1 21/assignments/01/index.pdf 2.2 Card (15 marks) You must implement the class Card An ohject of the class Card stores a suit and a rank, hoth of type int The class declares one constructor. It roceives the initial valae 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 noe of type Card, the method returns false, as these ohjects cannct he considered equals. Otheraise, the metod retums true if and only if the ohject designated hy parameter is ล Card that has the same saat and the same rank. Here is a stsating point for your implementation Cohject Instanceof Card) Card other: . The mxhod toString returns a string with the suit and the rank of this card. In order to kocp the representmion compact when printing an entire deck of cards, no other infomation han the suit and the rank is used. Soe below, Finally, the class Card declares four coastants: DIAMOND, CLUB, HEAKT, and SPADE, with values 0, 1. 2., and 3 respectively. Here is a small example showing the intended use. l Card. 3 ne Card(2. ) 6 Systen.out. printla(. equals(b)) Ealse 6:57 PM Type here to search 縮 × 1/26/2019

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