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
Draw a flow chart except the principle, time and date from the user. and display the simple interest and amount as output.​
timama [110]

Answer:

See attachment for flowchart

Explanation:

The explanation is as follows

1. Start

2. Get input for principal, time and rate

3. Calculate Interest using Interest = Principal * Rate * Time/100

4. Print Interest

5. Stop

7 0
3 years ago
What type of strategy is being used by a website like www.CNNMoney when it describes itself as ""a one-stop destination covering
alina1380 [7]

Answer:

Positioning

Explanation:

One of the most important concept of marketing is Positioning. It is a marketing concepts that provides a description of what businesses must do to ensure its products are marketed and its services rendered to customers. When positioning your organization, the image of the organization's product is created with its intended audience in mind, by using promotion, place, product, and price.

4 0
3 years ago
Read 2 more answers
list the six enternal parts or peripherals of a computer system and identify which are output and which are input devices?
inn [45]
There are many peripheral devices but heres 4 external output ones: monitor, speakers, plotter, and printer. Here are also 4 peripheral input devices: mouse, keyboard, mousepad, and joystick.
3 0
4 years ago
Read 2 more answers
Does anyone know edhesive 4.3 question 1
navik [9.2K]

No

.................................. :)

5 0
3 years ago
Read 2 more answers
True or False: Visual Studio is not a part of Unity. You could use a different code editor to edit your C# scripts if you wanted
gizmo_the_mogwai [7]

Answer:

True

Explanation:

Visual Studio and Unity are two different things. Visual Studio is an IDE developed by Microsoft, and Unity is a game engine developed by another company. Visual Studio is the default editor in Unity, but you are able to use something different.

Source: https://docs.unity3d.com/Manual/ScriptingToolsIDEs.html

7 0
3 years ago
Other questions:
  • William would like to sort a list of items after the data is already entered.
    9·1 answer
  • Jessica wants to purchase a new hard drive. She wants a drive that has fast access because she will use it to edit videos on her
    12·1 answer
  • Define the term Frame Rate.
    12·1 answer
  • C. you have already verified the routing table entries for r1, now execute the show run | section interface command to verify vl
    11·1 answer
  • Suppose we have a linearly separable dataset, and we divide the data into training and validation sets. Will a perceptron learne
    8·1 answer
  • Which of the following represents the biggest difference between asymmetric and symmetric cryptography?
    9·1 answer
  • An insulated anti-short fitting required to be installed in the ends of Type AC cable to protect the wires from abrasion is typi
    13·1 answer
  • Write down the three part of a computer.<br>​
    7·1 answer
  • 01 Describe all the possible component of a chart​
    8·1 answer
  • Julie has a difficult time seeing her computer Screen and uses adaplive technology tools to help he see better. One of the tools
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!