Write a class that encapsulates a deck of cards

Assignment Help Computer Engineering
Reference no: EM13322675

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: EM13322675

Questions Cloud

Determine vb of the load b after it has dropped 200 mm : A 40 kg sheave a OF RADIUS R=350 mm. and cenral radiusof gyration k=250 mm carries a 160 kg load b and is suspended by a cable and a spring of modulus k=1.2 kN/m.
Explain what is the resulting ph of koh : What is the resulting pH when .005 moles of KOH is added to .1 L of buffer solution that is .100 M in H2PO4- and .100 m HPO4^2- and the Ka2 = 6.2x10^-8
The implementation of the welfare system : In the implementation of the welfare system, it is established and primarily funded by the federal government.
At what frequency will the fuse burn out : A 58.0 %u03BCF capacitor is connected to a generator operating at a low frequency. The rms voltage of the generator is 5.00 V and is constant. at what frequency will the fuse burn out
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.
What does the water content of sludge need to be in energy : A POTW facility that operates an anaerobic digestion process generates 2200 tones of waste water sludge per year. The solids content of the raw sludge is 4% by weight.
What are the speed and water pressure at the second floor : A water pipe is having a 2.5cm inside diameter carries water into the basement of a house at a speed of 0.90m/s, what are the speed AND water pressure at the second floor
How to calculate the equilibrium concentration of brcl2 : .28 moles of Br2 and .32 moles of CL2 are introduced into a 5.0 L container at 298 K calculate the equilibrium concentration of BrCl2
Determine the maximum absolute values of the shear : Draw the shear and bending moment diagrams for the beam AB, and determine the maximum absolute values of the shear and bending moment.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Define some data are calculated as functions

Some data are calculated as functions. When will you store data in database and when would you use functions? What is the advantage of storing data in database.

  Classify the use and location of firewalls

Classify the use and location of Firewalls Categorize the use and location of IPS or IDS where necessary.

  Write down python program

Write down Python program

  Find out which servers might need more system resources

define what components she'll need to add or upgrade, at minimum, to make Nichol's servers capable of running Windows Server 2008. Also, explain why you don't recommend leaving all the servers at the minimum hardware requirements. Write down four ..

  Design a visual c-sharp program for an ice cream shop

design a Visual C-Sharp program for an Ice Cream Shop. The program will store data about ice cream cones and customers.

  Write pseudocode to implement this reusable code

You realize that the code you had created can be reused for varios other purposes for future programs. You decide to create a library for your reusable code.

  Express the advantages of joining two tables

express the advantages of joining two tables.What is the inner join and what is outer join? Please give me some real applications of joins.

  Data-communication system

A data-communication system operates at the 28.8 kb/s (typical of the current high-speed telephone modems).

  Why the client receives both the web page

assume you click on a link within your Web browser to obtain a Web page. The IP address for the associated URL is not cached in your local host, so a DNS look-up is necessary to obtain the IP address.

  Write a short on structured design

Identify task you perform regularly, such as cooking, mowing the lawn, or driving a car

  Preserve uppercase letters for the first word of sentence

create a program that can be used to train the user to use less sexist language by suggesting alternative versions of sentences given by the user.

  How the smallest word is at offset 0000

Sort all the words in memory that could be considred to be decimal ASCII-coded numbers. An ASCII-coded word can vary from 3030h (00d) to 3939h (99d). Sort the ASCII words so that the smallest word is at offset 0000.

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