Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

BE SURE TO ANSWER ALL PARTS OF THE QUESTION (0) Suppose a C++ class is needed to represent a playing card in a computer program.

image text in transcribed

BE SURE TO ANSWER ALL PARTS OF THE QUESTION (0) Suppose a C++ class is needed to represent a playing card in a computer program. The class should be named Card and it should have two member variables for a pip_value (a positive integer) and suit. For example, for the ace of spades, the pip-value is 1, and suit is "Spades". Write a declaration for this class using the most suitable data types. Declare a default constructor and an initializing constructor (with one parameter for each member variable). The constructors should be available outside the class but the variables should not be. (ii) Write the prototype for a function named searchForCard that determines whether or not an array of Cards contains a particular card. This function is not a member function of the Card class. The three parameters are: an array of Cards, the number of Cards in the array, and the Card to search for. Use the most suitable return type for the function. You DO NOT have have to write the function itself. (iii) Show how you would declare a variable in the main function of the Card type using the initializing constructor to give it values for a jack of Hearts (which has a pip_value of 11 and a suit value of "Hearts"). Then declare an array named deck to contain 52 Cards. Then show how to call the searchForCard function trying to find the jack of hearts using the variable you declared

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

Beginning ASP.NET 2.0 And Databases

Authors: John Kauffman, Bradley Millington

1st Edition

0471781347, 978-0471781349

Students also viewed these Databases questions

Question

Why would controls be tested for the whole period being audited?

Answered: 1 week ago

Question

Is differentiable at x = 2? Justify your answer. .2 x? 5 + 6 f(x) 2

Answered: 1 week ago

Question

8. Providing support during instruction.

Answered: 1 week ago