Question: Using matlab write script using loop 5. Coin Toss Write a program for the following game Asks the user if he would like to play.
5. Coin Toss Write a program for the following game Asks the user if he would like to play. He must pay $10 (the ante) per round to play Using the rand function, simulate a fair coin toss. If the coin turns up heads, then the user wins $20. If the coin turns up tails, then the user gets nothing Allow the user to play this game repeatedly. Assume he borrows the house's money to play each round, so he starts off with $0. Keep track of his fortune If the user's fortune gets below -$50.00, tell him that he might want to think about stopping If his fortune gets above $50, tell him that the casino will give him a free suite for the night (only tell him this once!). In either case, allow the user to continue playing. When the user quits, tell him how much money he has (or owes) and the total number of times he bet on the coin toss Save your script file as coinToss.m. Paste some output from a few test runs in Lab4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
