Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

LANGUAGE C++ Topical Information This lab will help you practice with operator overloading (NOT mixed with class es). Program Information Write a program that allows

LANGUAGE C++

Topical Information

This lab will help you practice with operator overloading (NOT mixed with classes).

Program Information

Write a program that allows the user to enter the values to assign a card's suit (commonly implemented as an enumeration Hearts, Clubs, Diamonds, Spades) from the keyboard. You cannot use a menu. Your program must read the user's choice directly into the card suit variable (of an enum type). (Note: You cannot overload operators for built-in types, but enumerations are, technically, user-defined types. Therefore you can overload input/output operators for them.)

This proof of conceptapplication will help show your programming team that the bridge game you are designing can accept bids directly from the player without having to rely on a clumsy menu interface.

An example program interaction might look something like (the parts in this color are typed by the user):

$ ./suitenter.out Welcome to the Card Suit Entering Program!!! What is the suit of your card? hearts You have a heart! Don't wear it on your sleeve..! Another card? y What is the suit of your card? s So, you have a spade! Dig me a hole out back, won't you? Another card? Y What is the suit of your card? CLUBS Ah, a club! Don't beat me up!! Another card? y What is the suit of your card? diagonal I'm sorry, I don't recognize that suit...please try again. What is the suit of your card? dia Ooo...diamonds. Don't cut my monitor with those! Another card? n Thank you for using the CSEP!! Endeavor to have a stimulating day! $ 

Thought Provoking Questions

(As always, these are meant to provoke your thoughts and push you in the direction of a good solution to the programming problem. You shouldanswer these now before you start coding your own solution. On occasion, you may not understand what a question means before coding, but you'll find it helpful during the coding process more than likely.

Also note that since these questions are meant to 'provoke thoughts', they all imply a ' why', ' why not', 'how', or the like as follow-up. Never is a simple 'yes' or '4' the answer no matter how much you'd like it to be. Always answer in complete sentences and explain your answer/choice!

And remember: you won't get full credit unless you answer these questions appropriately!)

Does it matter if your operators are class members? Should they be const? Do they need to be friends?

How can you match the word the user types against the suit names? How can you match only the number of characters entered? (Note the matches are case insensitive...)

Might your program benefit from use of the string or Stringclasses?

What other operators might prove useful for your enumerated type in a full card game program?

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

Oracle Database 11g SQL

Authors: Jason Price

1st Edition

0071498508, 978-0071498500

Students also viewed these Databases questions

Question

Why is the System Build Process an iterative process?

Answered: 1 week ago