Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

/ * * Click nbfs: / / nbhost / SystemFileSystem / Templates / Licenses / license - default.txt to change this license * Click nbfs:

/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Main.java to edit this template
*/
package card;
/**
* A class that models playing card Objects. Cards have
* a value (note that Ace =1, Jack -11, Queen =12, King =13)
* A suit (clubs, hearts, spades, diamonds).
* There are 52 cards in a deck, no jokers.
* This code is to be used in ICE1. When you create your own branch,
* add your name as a modifier.
* @author srinivsi
*/
public class Card {
private String suit; //clubs, spades, diamonds, hearts
private int value;//1-13
public static final String [] SUITS ={"Hearts", "Diamonds", "Spades", "Clubs"};
/**
* @return the suit
*/
public String getSuit(){
return suit;
}
/**
* @param suit the suit to set
*/
public void setSuit(String suit){
this.suit = suit;
}
/**
* @return the value
*/
public int getValue(){
return value;
}
/**
* @param value the value to set
*/
public void setValue(int value){
this.value = value;
}
}
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package card;
/**
* A class that fills a magic hand of 7 cards with random Card Objects
* and then asks the user to pick a card and searches the array of cards
* for the match to the user's card. To be used as starting code in ICE 1
* @author srinivsi
*/
public class CardTrick {
public static void main(String[] args)
{
Card[] magicHand = new Card[7];
for (int i=0; i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

More Books

Students also viewed these Databases questions