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
In which of the following situations may you pass on the right
Natasha2012 [34]
In driving your vehicle, it is best to pass on the right after you slow your vehicle down and check for the road whether there is an upcoming vehicle or not. When the road is clear, it is best and safe to pass on the right after making sure that the coast is clear.
3 0
2 years ago
Read 2 more answers
Which of the following is not an example of a technological aid?
emmainna [20.7K]
I think the correct answer among the choices given is option A. Manipulative aids are not technological aids. It refers to items that is used to support hands-on learning like markers, toothpick or coins. Technological aids, on the other hand, are things which makes use of the new technology present like slideshows, DVD's, audioclips and projectors.
6 0
2 years ago
You are trying to access the Wi-Fi network at a coffee shop. What protocol will this type of wireless networking most likely use
Anna71 [15]

The wireless network is called WAP protocol

8 0
2 years ago
Jim has entered the age of each of his classmates in cells A1 through A65 of a spreadsheet.
alexandr402 [8]
The answer to this is B=MODE(A1:A65)
8 0
3 years ago
After creating the home page or any other page of a website and adding content to it, it must be displayed in a browser to view
konstantin123 [22]

Answer:

The answer is "True".

Explanation:

The web page is also known as a home page when it collects more than one page, it is called website. In web page designing, it uses the HTML for design a page and is also available via the web or other networks.

  • When we insert a URL address to the Web page, it means, it contains the text, graphics, and hyperlinks to other Web pages and files.
  • It also displays all the data on the page, that's why the given statement is true.
3 0
3 years ago
Other questions:
  • Adam is so good at playing arcade games that he will win at every game he plays. One fine day as he was walking on the street, h
    13·1 answer
  • An email message form includes all of the following main areas except
    11·2 answers
  • You are asked to optimize a cache design for the given references. Th ere are three direct-mapped cache designs possible, all wi
    7·1 answer
  • What does the Additional Clock tab do?
    11·1 answer
  • Which of the following are typically an example of primary resources?
    13·1 answer
  • Why do bats sleep upside down
    7·1 answer
  • Question 12 (2 points)
    10·2 answers
  • PYTHON:Given the dictionary, d, find the largest key in the dictionary and associate the corresponding value with the variable v
    12·1 answer
  • What is a man-in-the-middle attack​
    14·2 answers
  • What is output?<br> x = 2<br> y = 3<br> print (x * y + 2)<br> 4<br> 2<br> 8<br> 10
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!