Scenario:
After practicing and learning problem solving skills for an extended period of time, you have decided
that life would be easier if you did not need to continue with school. Rather, you decide that winning a
large amount of money on a game show would be the easier path to make your dreams come true. You
decide you want to try out for a game show that you know about. It has a top prize of \$1,061,061. In
order to practice for the game show, you decide to build a program that could help you win.
The game show is based on four players (Player 1, Player 2, Player 3, and Player 4), playing three rounds
of a pricing game. In each round, players try to guess the exact price of an item, getting as close to the
exact price without going over and busting. For example, if the exact price of an item is \$97.18, and
guesses for the price are \$87.22, \$91.29, \$97.19, and \$104.21, the winning guess would be \$91.29
because it was the closest guess to the exact price without going over and busting. Two players cannot
guess the same price. If a second player guesses a price already guessed, they should be asked to guess
a different price. If all players have busted, they are told they have all busted and are given an
opportunity to guess again. Each round must have a winner. (Note: For this assignment, you will make
up the exact prices and price guesses in each round as you are testing your solution algorithm and
program. These should be gathered through user input and not hardcoded into your program)
After all three rounds are played, prizes are awarded as follows:
 0 rounds won – \$106 consolation prize
 1 round won – \$1,061 prize
 2 rounds won – \$10,610 prize
 3 rounds won - \$1,061,061 prize
Create a modular program that will simulate running all three rounds of the game show. Once the
rounds have been completed, the program will output a report (dialog box) containing a list of the
players, the number of rounds each player won, and the prize they have won.

DO NOT WORRY ABOUT THE LINE NUMBERS, DIDN'T FIX THEM YET.

``````Solution Algorithm

PROCESS_PRICING GAME

2   SET maxNumPlayers = 5
4   GET_game1(maxNumPlayers)
5   SET player1winnings = 0
SET player2winnings = 0
SET player3winnings = 0
SET player4winnings = 0
PRINT_PAYROLL_INCREASE_REPORT(player1_winnings,  player2_winnings,  player3_winnings,  player4_winnings  player1prize, player2prize,  player3prize,  player4prize)

GET_game1(maxNumPlayers)
8       item1 = GET_ITEM1_PRICE
9       player1 = GET_PLAYER1_PRICE
Player2 = GET_PLAYER2_PRICE
Player3 = GET_PLAYER3_PRICE
Player4 = GET_PLAYER4_PRICE
ENDDO
END

GET_ITEM1_PRICE
REPEAT
10        PROMPT user for item1
12        IF (item1 = “”) THEN
PRINT “Error! You must enter the price!”
ENDIF
UNTIL item1 NOT “”
END

GET_PLAYER1_PRICE
REPEAT
13        PROMPT user for player1
15        IF (player1 < 0) THEN
PRINT “Error! Price amounts must be more than \$0”
ENDIF
UNTIL player1 > 0
END

GET_PLAYER2_PRICE
REPEAT
13        PROMPT user for player2
15        IF (player2 < 0 OR player2 = player1) THEN
PRINT “Error! Price amounts must be more than \$0 and not same as previous player”
ENDIF
UNTIL player2 > 0 and player2 NOT= player1
END

GET_PLAYER3_PRICE
REPEAT
13        PROMPT user for player3
15        IF (player3 < 0 OR player3 = player1, player2) THEN
PRINT “Error! Price amounts must be more than \$0 and not same as previous player”
ENDIF
UNTIL player3 > 0 and player2 NOT= player1, plyaer2
END

GET_PLAYER4_PRICE
REPEAT
13        PROMPT user for player4
15        IF (player4 < 0 OR player4 = player1, player2, player3) THEN
PRINT “Error! Price amounts must be more than \$0 and not same as previous player”
ENDIF
UNTIL player4 > 0 and player4 NOT= player1, plyaer2, plyaer3
END

CALCULATE_PLAYER_WINNING(maxNumPlayers)
16  DO index = 1 TO maxNumPlayers
17      IF
ENDDO
END
``````

STUCK HERE AT IF TO FIND OUT THE WINNER.

what's stopping you from using variables that can be read/written throughout your entire code?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.