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]
4 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]4 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
The use of technological advances in agriculture to increase harvests
BigorU [14]
Tractors,water works, plows, water in general
3 0
3 years ago
Safety glasses should be worn in which of the following situations?
N76 [4]
When any substance is being heated. Safety glasses
8 0
3 years ago
هل تعتبر الشاشة من الوحدات الإدخال والاخراج​
dmitriy555 [2]

Answer:

لا

Explanation:

تعد من وحدات الاخراج فقط

4 0
3 years ago
Read 2 more answers
I'm working on an assignment for my computer science class (Edhesive) and when I run the code, there are no errors. But when I t
vova2212 [387]

Answer:

The error is because you wrapped the input in float. First record the input and then modify it.

Explanation:

b =  input("enter temp:")

b = float(b)

6 0
3 years ago
Assume you are on the only person to write program on this system. Assume the system's OS uses the "priority-scheduling" schedul
kondor19780726 [428]

Answer:

1. Write all programs to have the same priority.

Explanation:

Write all programs to have same priority. So that there will be no context switching in between.

7 0
3 years ago
Other questions:
  • Match the job skills with the correct job role.
    12·1 answer
  • Drag the correct type of update to its definition.
    5·1 answer
  • Once Google Analytics processes data, it’s stored in a database where it can’t be modified.
    9·1 answer
  • Write a C++ program that determines if a given string is a palindrome. A palindrome is a word or phrase that reads the same back
    6·1 answer
  • Use the ________ method to write text to a web page.
    12·1 answer
  • When the Squirrel peer-to-peer web caching service was evaluated by simulation, 4.11 hops were required on average to route a re
    11·1 answer
  • Which of the following are some of the ways that the media influences consumers behavior
    9·1 answer
  • Which TWO objects are likely to have SSD chips in them?
    5·2 answers
  • Missing appropriate security hardening across any part of the application stack or improperly configured permissions is an examp
    11·1 answer
  • What are some of the characteristics found in an editorial photograph?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!