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
This is for C++: Using a nested for loop output the following pattern to the screen:
olga55 [171]

Answer:

Following are the code to the given question:

#include <iostream>//header file

using namespace std;

int main()//main method

{

int r=26,x,y;//defining integer variable  

char c;//defining a character variable

for(x= 1; y<= r; x++)//using for loop for count value

{

for(y= 1; y<= x; y++)//using for loop to convert value in triangle  

{

c=(char)(y+64);//convert value into character  

cout << c;//print character value

}

cout << "\n";//use print method for line break

}

return 0;

}

Output:

Please find the attachment file.

Explanation:

In this code, three integer variable "x,y, and r", and one character variable "c" is declared, that is used in the nested for loop,  in the first for loop it counts the character value and in the next for loop, it converts the value into a triangle and uses the char variable to print its character value.

3 0
2 years ago
During which step of the problem-solving process would group members combine and elaborate on ideas? Define the problem. Analyze
slava [35]

In a problem-solving process occurring inside a group, (C) develop creative solutions would be where the members combine and elaborate on ideas.

Brainstorming would be a prominent feature during this process since group members would be encouraged to state her or his opinion and solutions about the problem that the group needs to solve.

5 0
3 years ago
Technical colleges offer certification in audio engineering through programs that are normally from 2 to 6 months long.
Murrr4er [49]

Answer:

False

Explanation:

i said so

8 0
3 years ago
Drag the words into the correct boxes
tresset_1 [31]

Explanation:

if you have any doubts or queries regarding the answer please feel free to ask

4 0
2 years ago
What are examples of people who own the copyrights of their property? Check all that apply.
jolli1 [7]
"Nevaeh thinks of a name for her new company", "Alexis thinks of an idea for a new product" and "Josiah writes a poem" are open to copyright because they can claim that their work is original and cannot be reproduced without their consent. 
3 0
3 years ago
Read 2 more answers
Other questions:
  • What is process equipment?
    12·1 answer
  • Will upvote all answers
    7·1 answer
  • Describe one example of how technology assits people with data and sample collection
    14·2 answers
  • Jean has created a database to track all of this month’s family meals. To find an entry for lasagna, what would should Jean do?
    6·1 answer
  • What type of attacks take advantage of vulnerabilities in poorly coded web application software to introduce malicious program c
    9·1 answer
  • List any two programs that are required to play multimedia products
    8·1 answer
  • Discussion Topic
    8·1 answer
  • What is operating system​
    10·2 answers
  • A mesh network topology allows all computers to be directly connected. True or False
    9·1 answer
  • What is the duty of WHH? (white hat hackers)<br><br><br>ANY WHH HERE?<br>​
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!