Question: First Program (C++) You are asked to write a program to simulate a simple card game. The only cards allowed in this game are: Jack,
First Program (C++)
You are asked to write a program to simulate a simple card game. The only cards allowed in this game are: Jack, Queen, King and Ace.
These cards could be of any suits. Two players will play this game, the cards will be randomly picked for them. In order to be able to randomly pick these cards, we generate a random number in the range 1 through 4, for both face and suit for each player, then we can implement the following pattern:
1 representing Jack
2 representing Queen
3 representing King and
4 representing Ace
We can come up with the same plan for the suits:
1 representing Clubs
2 representing Diamonds
3 representing Hearts and
4 representing Spades
You can use switch statements for this, Cant you? So for example if the random number came out to be 1, you store "Jack" in your variable, etc.
In case the random number generator picked identical cards for the two players, you announce violation and end the game, if the game was valid, then you must compare the cards based on their faces and announce the winner. You first ask the user for the names of the players:
Please enter the name of the first player: Mary
Please enter the name of the second player: Jack
When you have the cards drawn/generated, you will display the following output based on your condition checking:
Mary drew King of Hearts
Jack drew Ace of Diamonds
Jack wins the game!
Or we may have:
Mary drew King of Hearts
Jack drew King of Spade
The game is a draw.
In case we have:
Mary drew King of Hearts
Jack drew King of Hearts
Violation of Rules!
Game is void!
This is the end of the first program
Second Program (C++)
Students can apply for two projects: Project A and Project B. You are asked to write a program to let the students know whether they are qualified for either one of these projects. The followings are the rules for qualification for these projects respectively:
Project A: Undergraduate students who have taken at least 12 hours of programming courses will qualify for this project. All graduate students will qualify for this project.
Project B: Undergraduate students who have a GPA higher than 3.5 will qualify for this project. Graduates students who have successfully completed their course work will qualify for this project.
So the first menu you show the user for this program is:
Please enter your status:
1. Undergraduate Student
2. Graduate Student
Please enter your choice:
1. Project A
2. Project B
Then you need to come up with your own follow up questions or you may choose to show other submenus to collect information and let the user know whether they qualify for their choice of project or not. This will be up to you.
Make sure you test your program based on different user input to make sure that your code works properly. Upload your two programs separately and by the due date on blackboard.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
