True Start Read raw = 0, boiled = 0 min = 0, max = 0 userGuess, random_Num userGuess = get next input read userGuess for e = 0; e <= 11 ;e++ generate random_Num if random_Num == 0 True boiled = boiled e=e+1 -False boiled = boiled + 1 -False- True Put "You Win!' to output Print boiled if boiled = userGuess False Put "You Lose!" to output

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter8: Advanced Data Handling Concepts
Section: Chapter Questions
Problem 10PE
icon
Related questions
Question

Write a running Coral code for the flowchart given. Code must be able to process correctly through the Coral simulator ( https://corallanguage.org/simulator/ )

## Flowchart for a Simple Guessing Game Algorithm

### Overview

This flowchart outlines the steps for a simple guessing game. The game involves the following key steps:

1. Initialize variables.
2. Obtain user input.
3. Generate random numbers.
4. Determine if the user's guess matches the randomly generated value.
5. Provide feedback on if the guess was correct.

### Detailed Explanation

1. **Start**:
    - The process begins.

2. **Read**:
    - Initialize variables `raw`, `boiled`, `min`, and `max` to 0.
    - Initialize `userGuess` and `random_Num`.

3. **Input**:
    - `userGuess = get next input`
    - The user inputs a guess.

4. **Read User Guess**:
    - Read the value of `userGuess`.

5. **Loop (for e = 0 ; e <= 11 ; e++)**:
    - A loop is set to iterate 12 times (from 0 to 11).

6. **Generate random_Num**:
    - During each iteration, generate a random number `random_Num`.

7. **Condition (if random_Num == 0)**:
    - If the generated `random_Num` is 0.
        - Increment `boiled`.
    - Otherwise:
        - Do not increment `boiled`.

8. **End of Loop**:
    - After completing 12 iterations of the loop, proceed to the next step.

9. **Print boiled**:
    - Output the value of `boiled`.

10. **Condition (if boiled == userGuess)**:
    - Check if the `boiled` value matches the `userGuess`.
        - If `true`, output "You Win!"
        - If `false`, output "You Lose!".

### Flowchart Explanation

**Shape Descriptions:**
- **Rounded Rectangles** (Start, End): Represents the beginning and end of the algorithm.
- **Parallelograms** (Input/Output): Represents user input and printed output.
- **Diamonds** (Decision): Represents conditional checks (e.g., if statements).
- **Rectangles** (Process): Represents steps involving processing (e.g., assigning variables, loops).

This simple guessing game involves user interaction and probabilistic elements (random number generation), providing an educational example of basic control structures in programming, including loops and conditional statements. The user guesses a
Transcribed Image Text:## Flowchart for a Simple Guessing Game Algorithm ### Overview This flowchart outlines the steps for a simple guessing game. The game involves the following key steps: 1. Initialize variables. 2. Obtain user input. 3. Generate random numbers. 4. Determine if the user's guess matches the randomly generated value. 5. Provide feedback on if the guess was correct. ### Detailed Explanation 1. **Start**: - The process begins. 2. **Read**: - Initialize variables `raw`, `boiled`, `min`, and `max` to 0. - Initialize `userGuess` and `random_Num`. 3. **Input**: - `userGuess = get next input` - The user inputs a guess. 4. **Read User Guess**: - Read the value of `userGuess`. 5. **Loop (for e = 0 ; e <= 11 ; e++)**: - A loop is set to iterate 12 times (from 0 to 11). 6. **Generate random_Num**: - During each iteration, generate a random number `random_Num`. 7. **Condition (if random_Num == 0)**: - If the generated `random_Num` is 0. - Increment `boiled`. - Otherwise: - Do not increment `boiled`. 8. **End of Loop**: - After completing 12 iterations of the loop, proceed to the next step. 9. **Print boiled**: - Output the value of `boiled`. 10. **Condition (if boiled == userGuess)**: - Check if the `boiled` value matches the `userGuess`. - If `true`, output "You Win!" - If `false`, output "You Lose!". ### Flowchart Explanation **Shape Descriptions:** - **Rounded Rectangles** (Start, End): Represents the beginning and end of the algorithm. - **Parallelograms** (Input/Output): Represents user input and printed output. - **Diamonds** (Decision): Represents conditional checks (e.g., if statements). - **Rectangles** (Process): Represents steps involving processing (e.g., assigning variables, loops). This simple guessing game involves user interaction and probabilistic elements (random number generation), providing an educational example of basic control structures in programming, including loops and conditional statements. The user guesses a
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 4 images

Blurred answer
Knowledge Booster
Methods of StringBuilder class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT