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
Vika [28.1K]
3 years ago
9

The goal for me is that I need to identify the objects needed for the UNO card game and the actions that those objects perform,

rather than how the objects are suppose to actually be represented. Write a document that includes an ADT (abstract data type) for each object needed in my program. This is a partial ADT for the UnoCard class.
//get the color of the car
+getColor(): String
//set the color of the card
+setColor(color : String):void
//get the value of the card
+getValue(): int
//set the value of the card
+getValue(val : int): void
//return true if card has same value or
//same color as the card
//return false otherwise
+isMatch(card: UnoCard): boolean
The standard UNO card must be able to report both its color and value, and, when given another card, tell whether or not it is a "match.
Computers and Technology
1 answer:
Alik [6]3 years ago
6 0

Answer:

Explanation:

//Java program

class UnoCard{

  private String color;

  private int value;

 

  public UnoCard(String color , int val) {

      this.color = color;

      value = val;

  }

  public String getColor() {

      return color;

  }

  //set the color of the card

  public void setColor(String color ) {

      this.color = color;

  }

  //get the value of the card

  public int getValue() {

      return value;

  }

  //set the value of the card

  public void setValue(int val) {

      value = val;

  }

  //return true if card has same value or

  //same color as the card

  //return false otherwise

  public boolean isMatch(UnoCard card) {

      return (this.value==card.value)||(this.color==card.color);

  }

}

public class Card {

  public static void main(String args[]) {

      UnoCard card1 = new UnoCard("Red",10);

      UnoCard card2 = new UnoCard("Green",10);

      UnoCard card3 = new UnoCard("Blue",15);

     

      if(card1.isMatch(card2))System.out.println("Match");

      else System.out.println("No Match");

     

      if(card2.isMatch(card3))System.out.println("Match");

      else System.out.println("No Match");

  }

}

You might be interested in
ASAP
grin007 [14]
I would recommend A. Quickly on the left and move ahead of it because you should always pass on the left and seeing as it is a large truck, you would want to get ahead of it ASAP.
4 0
3 years ago
Read 2 more answers
How can development in ICT be utilized to speed up the development and integration efforts
maw [93]

Answer:

Explanation:

1.  Sustainability and scale

2.  Lack of knowledge

 

3. Pace of change

4.  Funding

5. Changing roles and norms

7 0
3 years ago
What do you call a collection of pre-programmed commands and functions used in programs?
Keith_Richards [23]

Answer:

<h2><em>Heya</em><em> </em><em>Buddy</em><em>.</em><em>.</em></h2>

Explanation:

<em>A computer program is a collection of instructions that can be executed by a computer to perform a specific task. ... A collection of computer programs, libraries, and related data are referred to as software.</em>

<em>Hope</em><em> </em><em>that</em><em> </em><em>helps</em><em> </em><em>you</em><em> </em><em>dear</em><em>.</em><em>.</em>

<em>Bye</em><em>!</em>

6 0
3 years ago
What is a mini computer and what are it’s typical applications?
Molodets [167]

Answer:

it is a computer of medium power more than a microcomputer but less than a.minuframe

3 0
3 years ago
Read 2 more answers
Brainliest Answer!!
olganol [36]
The answer to your question is true
6 0
3 years ago
Read 2 more answers
Other questions:
  • Why would you convert your birth year to binary numbers?
    6·1 answer
  • You're working at a large industrial plant and notice a tag similar to the one shown in the figure above. Which of the following
    9·2 answers
  • Security awareness training can reduce the risk of a data breach by what percentage?
    12·1 answer
  • The ip address 221.1.10.53 /24 is a what type of address?
    6·1 answer
  • ICT excel data homework
    10·1 answer
  • Write a program that will ask the user to enter the amount of a purchase. The program should then compute the state and county s
    8·1 answer
  • An aerophone is an instrument that causes ________ to vibrate, thus creating sound waves.
    11·2 answers
  • Jabria are you smart
    14·2 answers
  • True false.
    10·2 answers
  • In a selection, the else clause executes ______________. a. always b. when the tested condition is false c. when the tested cond
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!