Write a class that encapsulates a deck of cards

Assignment Help Computer Engineering
Reference no: EM13322890

Write a class (and a client class to test it) that encapsulates a deck of cards. A deck of cards is made up of 52 cards. You should have three instance variables:

-a two-dimensional array of values representing the cards

-a single-dimensional arrary describing the suit: spades, hearts, diamonds, and clubs

-an instance variable representing the trump suit

For the two-dimensional array, dimension 1 represents the suit and dimension 2 represents the type of card (ace, two, three...,jack, queen, king). Your constructor should take one parameter, which will represent the suit of the trump. Based on that , the cards should be given the follwoing values:

-Non-trump for 2 to 10: 1 point

-Non-trump jack = 2

-Non-trump queen = 3

-Non-trump king = 4

-Non-trump ace = 5

-Any trump card = Non-trump value +1

You should include the following methods:

-a method returning the trump suit, by name

-a method printing the whole deck of cards, suit by suit, with the value for each card

-a method taking a String as a parameter representing a suit, and returning the total value of the cards of that suit

 

Reference no: EM13322890

Questions Cloud

Propose a range of addresses for acme corp : ACME Corp is located in Toledo, Ohio. They would like to create a network and divide it into 3 subnets, each subnet has 150 computers. The IT plan calls for connecting the LAN to the Internet. ACME Corp. has elected to use public IP address space ..
How much kinetic engergy does negatively charged object gain : A very small object carrying -3 x 10-6 C of charge is attracted to a large, How much Kinetic Engergy does the negatively charged object gain
Evaluate the degree of dissociation : This solution freezes at -0.159C calculate the degree of dissociation( the fraction of molecules dissociated) for the acid in this solution ( assume the mean ionic activity coefficient has a value of 1). c) from the dgree of dissociation determine..
Choose the strategies that seem to be complementary : Choose the strategies that seem to be complementary to one other and could be implemented simultaneously. Justify your response.
Write a class that encapsulates a deck of cards : Write a class (and a client class to test it) that encapsulates a deck of cards. A deck of cards is made up of 52 cards. You should have three instance variables.
Define how many moles are present in the tank : If 8.0 moles of the gas A is placed in a 60.0 L tank with 1.0 moles of B at 0 degrees celsius and 1 atm, they react according to the equation. 2A(g) + B(g) ---> 3C(g) + D(g) How many moles are present in the tank when the reaction is complete
How many kilojoules of heat were absorbed : An ice bag containing 212g of ice at 0 °C was used to treat sore muscles. When the bag was removed, the ice had melted and the liquid water had a temperature of 32.5°C.How many kilojoules of heat were absorbed?
Produce the result as the user instructed on the screen : Produce the result as the user instructed on the screen with appropriate messages.
An environmental science class : An ENVIRONMENTAL SCIENCE CLASS

Reviews

Write a Review

Computer Engineering Questions & Answers

  The decision-making logic of a human expert is known as

the decision-making logic of a human expert is known as.

  Program with a function that returns a random integer

Program with a function that returns a random integer

  Find out how many of each kind of bill to dispense

Write down a program for an automatic teller machine that dispenses money. The user should enter the amount desired (a multiple of ten dollars) and the machine dispenses this amount using the least number of bills. The bills dispensed are 50s, 20s..

  A palindrome consists of a word or deblanked

A palindrome consists of a word or deblanked, unpunctuated phrase that is spelled exactly the similar when the letters are reversed. Write a recursive function that returns a value of 1 if its string argument is a palindrome.

  Creating the algorithm

We suppose that we are given a majority graph in order to generate agenda for managing the sequential majority kind of election.

  What are values of sum1 and sum2

If the operands in expressions are evaluated left to right. If the operands in the expressions are evaluated right to left? Sum1=48, Sum2=46

  Compute the minimum salary for all employees

compute the maximum salary for exempt employees and the maximum salary for non-exempt employees.

  Security vulnerability

What is the security vulnerability of this solution

  How to deal with such issues

Whilst group synergy is good phenomenon to observe in action, the converse is sometimes just alike  to occur with work teams (virtual or otherwise). That is, teams might sometimes have disruptive or non-cooperative members who impair performance.

  How is the logical-to-physical address

How is logical-to-physical address mapping accomplished in this system? (For the indexed allocation, assume that a file is always less than 512 blocks long.)

  Designing a controller for new satellite

You are allocated to work on the project in order to design a controller for the new satellite. In order to save the money, your manager estimates you would reuse around 90% of software from one of two similar satellites the company built in the p..

  Create a shippedorder class that derives from order

Create a ShippedOrder class that derives from Order.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd