Answered step by step
Verified Expert Solution
Question
1 Approved Answer
* * * PLEASE HELP WITH CORAL CODE FORMAT ONLY * * * I have my code already and would simply like for an expert
PLEASE HELP WITH CORAL CODE FORMAT ONLY
I have my code already and would simply like for an expert to review it and see if it is missing anything or needs to be adjusted. I am fairly new to coral code and simply want some guidance for anything I may be missing or doing improperly.
Below is the scenario for the code:
Cracked Egg Game: There are a dozen eggs in a basket; some are hard boiled and some are raw. The object of this game is for the user to guess the number of hardboiled eggs prior to playing the game. The computer then simulates cracking all eggs, using a random number or to simulate raw or hard boiled. The number should represent raw eggs and the number should represent hard boiled. The computer must keep track of the number of hardboiled eggs. At the conclusion of cracking all eggs, the actual number of hard boiled is compared to the users guess, and whether the user won or lost is given as output.
Below is the CORAL code I have written so far:
Variables for code are listed here
integer raw
integer boil
integer min
integer max
integer boiled
integer i
integer ranNum
min
max
Program inquiry and User input
Put "How many hardboiled eggs do you think there are?" to output
boiled Get next input
Utilizing a "for" loop, this generates the random number of theta or
If the random number is theta then the egg is raw
else the egg is a hardboiled
count the number of hardboiled eggs
for i ; i ; i i
ranNum RandomNumber
if ranNum
raw
boil boil
else
boil boil
Outputs the quantity of hardboiled eggs determined by the code
Put
This is the number of hardboiled eggs there are: to output
Put boil to output
Outputs a "win" or "lose" message if the user's input and program's random number are the same or different
if boiled boil
Put
You have won the Cracked Egg Game! Congratulations!
Would you like to play again?" to output
else
Put
Sorry, you lost the Cracked Egg Game. Better luck next time!
Would you like to play again?" to output
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started