Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A program is needed that will simulate a game of chance, where the player bets o

ID: 3847827 • Letter: A

Question

A program is needed that will simulate a game of chance, where the player bets on the outcome
of a Snail Race. The player will be allowed to repeatedly select one of the following choices
from the menu as long as the player does not choose to quit the game or the player has not lost
all of his/her money through choosing snails that did not win a race.
Choose a snail upon which to place a bet
Choose to just watch a race, but not place a bet on a snail
Choose to leave the races (quit the game)
When the player selects a snail, the game action will proceed as follows:
provide the player the ability to enter an amount of money that he/she wants to wager on
the snail winning the race
simulate the racing of the snails through the use of the random number generator to
determine which of the snails wins the race and display which snail won the race
determine whether the player’s chosen snail won the race and either add to the player’s
money by 2 times the bet if the player’s chosen snail won or subtract from the player’s
money the amount of the bet if the player’s chosen snail did not win the race
display the player’s current amount of remaining money
re-display the game menu to the player and allow the game to begin again with the
remaining amount of player’s money
Should the player select the option to “Just Watch”, the game action will proceed as follows:
simulate the racing of the snails through the use of the random number generator to
determine which of the snails wins the race
display the player’s current amount of remaining money
re-display the game menu to the player and allow the game to begin again with the
remaining amount of player’s money


Should the player select the option to “Leave the races” or the player has lost all of his money in
the game, the game action will proceed as follows:
drop out of the game loop
following the game loop determine whether the player has any money left and output one
of the following messages before ending the program:
o if player has no money left – output a message that wishes the player better luck
next time and asks him/her to come play again soon
o if player has more money left than starting amount – output a message that
congratulations the player on the winnings and asks him/her to come play again
soon.

if player has some money left – output a message that thanks the player for playing
and asks him/her to come play again soon
Instructions:
Using the knowledge that you have gained about methods and the use of parameters and returned
values, you are to code a simple game program called SnailRaces. The logic design of this
program requires that several methods be used to perform the game actions of allowing the user
to select a snail, handling a bet entry and simulating the race along with determining the winner
of a race and calculating the monetary winnings or losses. To assist you in visualizing the major
tasks in this game, the following hierarchical chart has been provided.
The functional description of each method is given below.


Method: main()
The main method will operate as a main controller or driver of each of these game actions. It
will contain the master game loop.
Method: selectSnail()
This value-returning method will display the game’s menu. This method will insure that the
player selects only a valid choice from the menu. (HINT: Input validation required.) The
method will return the player’s validated menu choice back to the main() method. This method
does not require any parameter values to do its work.


Method: placeBet()
This value-returning method will need two pieces of data. This first data item will be the
player’s choice of a snail (the menu choice). The second data item will be the player’s amount
of remaining money with which he/she will be able to place a bet.
The method may make some comment about the snail that was chosen by the player, but it must
output a prompt for the player to enter the amount of money that he/she wants to bet on the
particular snail number that was chosen from the menu. The prompt might be something like
“How much money do you want to place on snail’s name”, where snail’s name is replaced with
one of the actual snail names that you’ve chosen.

The method should accept keyboard input for the amount of the bet. It should also validate that
the entered amount is not zero or less and that it is not more than the amount of money that
remains for the player (HINT: Data validation required). After a valid amount is entered for the
bet, then the bet amount is returned to the main() method.


Method: runRace()
This method will simulate a race of the three snails and determine the winner of the race by
creating a Random object and using an appropriate method of that class to generate a number
that serves to identify the winning snail for the race. The returned random number will need to
be limited to between 1 and n (the number of snails in the race). (Hint: review the nextInt()
method of the Random class, see Chapter 4, Section 4.11, pgs. 233 – 234, and Chapter 4
powerpoint slides).
To aid in simulating this race, the method will output an announcer’s call of the race – something
like: “And the snails are off, look at them GO!!!! The winner is ______” Where the randomly
generated number will be converted to the associated snail’s name.
This method will need to receive via a parameter the player’s snail choice (menu choice). After
the winning snail number has been produced, this method must determine whether the player’s
selected snail was the winning snail (Hint: player’s snail number == winning snail number).
This method will also need to receive via a parameter the player’s bet amount, because if the
player chose the winning snail, then the method will need to calculate two (2) times the bet
amount as the race winnings for the player. However, if the player did not choose the winning
snail, then the method must calculate the race lost, which can be calculated as (negative 1) times
the bet amount.
This method will need to return the positive or negative race winnings amount back to the main
method, where it can be used to adjust through addition of the returned amount the player’s
remaining money.
After completing the coding logic for this program, compile, execute and test the program to see
if it will provide a functional game that can be played. Then play the game to see if you come
home from the snail races as a winner or a loser.

Explanation / Answer

We can embrace a wherever clause with a FULL OUTER be a part of to urge come solely those rows wherever no matching knowledge between the connexion tables ar exist.

The following question returns solely those company that don't have any matching food in foods, also as that food in foods that don't seem to be matched to the listed company.

view plaincopy to clipboardprint?
SELECT a.company_id AS "a.ComID",   
a.company_name AS "C_Name",
b.company_id AS "b.ComID",   
b.item_name AS "I_Name"   
FROM company a
FULL OUTER be a part of foods b
ON a.company_id = b.company_id
WHERE a.company_id IS NULL   
OR b.company_id IS NULL   
ORDER BY company_name;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote