Cp5639 problem solving and programming - create a solution


You are to plan a solution for the problem described below. Along with the tools that you have used in lectures and the workshops such as IPO charts, functions, condition/action and loop tables, create a solution to the problem. Your solution will be presented as a runnable flowchart and will be detailed in a planning document.

The Problem:

You are to design a simple card guessing game, played by one player against the computer.

The game will begin by asking the user for their name: "Hello, what is your name?", then welcome the player to the game saying " welcome to the Card Guessing Game!"

The game will display 2 options for the user: "Play game (P) or Quit (Q)?" If the user choses "q" or "Q", the game will exit with a goodbye message: "Goodbye !"

If the player choses "p" or "P", the game will begin with brief instructions: "You have 10 rounds to guess if the computer's card is higher or lower than yours. Good luck!"

If the player choses anything else, an error message will appear and the player will be asked to select again a correct option.

When playing, a game consists of 10 rounds; each round begins by showing the round number to the player "This is round 1 / 10". Then, the game will randomly generate two numbers, one for the player and one for the computer; the two cards are generated so that they are different in value. These numbers are whole numbers between 1 and 13, representing cards: Ace, 2 -10, Jack, Queen and King.
The player will then be told the value of their card with both the number and the name of the card (1 is an Ace, 11 is a Jack, 12 is a Queen, and 13 is a King). The player is asked to guess if the computer's card is higher or lower, by entering H or L: "Is the computer's card higher (H) or lower (L)?"

The player will have to make a guess by entering H or L; upper and lower case must be accepted, but any other input will result in an error and being asked again. Once the player has chosen, then the computer's card will be announced to the player. The player is told if he guessed right or not: "Well done, you guessed right!", or "Sorry, better luck next time." Keep in mind that the Ace (1) beats everything else.

At the end of the ten rounds, the player is informed how many rounds he guessed right: ", you guessed right 4/10 rounds". Then, the game will exit with a goodbye message "Have a good day !"

Example of How the Game Runs:
C: Hello, what is your name?
P: Fred
C: Fred welcome to the Card Guessing Game!
C: Play game (P) or Quit (Q)?
P: x
C: Incorrect option, please choose P for Playing the game or Q for Quitting. P: xyz
C: Incorrect option, please choose P for Playing the game or Q for Quitting. P: Q
C: Goodbye Fred.
C: Hello, what is your name?
P: Fred
C: Fred welcome to the Card Guessing Game!
C: Play game (P) or Quit (Q)?
P: p
C: You have 10 rounds to guess if the computer's card is higher or lower than yours. Good luck!
C: This is round 1 / 10. Your card is 2 Two.
C: Is the computer's card higher (H) or lower (L)? P: abc
C: Incorrect option, please choose H for Higher or L for Lower.
P: H
C: The computer's card is 11 Jack Well done, you guessed right!
C: This is round 2 / 10. Your card is 7 Seven.
C: Is the computer's card higher (H) or lower (L)? P: L
C: The computer's card is 9 Nine. Sorry, better luck next time.
C: This is round 3 / 10. Your card is 10 Ten.
C: Is the computer's card higher (H) or lower (L)? P: L
C: The computer's card is 1 Ace. Sorry, better luck next time.
C: This is round 10 / 10. Your card is 12 Queen.
C: Is the computer's card higher (H) or lower (L)? P: L
C: The computer's card is 4 Four. Well done, you guessed right!
C: You guessed right 6/10 rounds. Have a good day Fred!

Planning:

You are to divide your solution into functions, following the principles shown in class. These may involve one for each menu option, as well as functions for parts of the program. For each function you are to provide an IPO chart listing all variables which are needed for your solution. In cases where selections are necessary, you must include a suitable condition action table directly below the IPO chart. You must also provide a loop description table for any loops needed in your plan.

Use the techniques and patterns that you have learned and seen demonstrated in class. Note that menu choice and other character selection should handle upper and lower case letters.

You also need to provide a flowchart with the complete game solution in Flowgorithm. Make sure that this flowchart and your planning document are consistent with each other!

You may show your assignment to your tutor during practical time to get comments or suggestions. It is important to note that you can only get help from staff in practical time after your practical work is finished.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Cp5639 problem solving and programming - create a solution
Reference No:- TGS02569852

Expected delivery within 24 Hours