Basic Control Flow

This experiment consists of two interactive simulations demonstrating basic control flow constructs:

Part I: Position of Point with Respect to a Rectangle (If-Else)

  1. Initialize Variables:
    • Enter the X and Y coordinates of the point in the provided input fields (default values are shown).
    • The rectangle's corner coordinates are displayed for reference.
  2. Select Code Prototype:
    • Use the dropdown menu to choose the code logic (e.g., if-else, if-else-if) for solving the point-in-rectangle problem.
  3. Confirm Selection:
    • Click the Ok button to confirm your code selection.
  4. Start Simulation:
    • The Start button will be enabled. Click Start to begin the step-by-step execution.
  5. Step Execution:
    • Click Next to proceed through each step of the code. The current state of variables and reasoning will be displayed.
  6. Stop/Reset:
    • Click Stop to abort and reset the simulation at any time.

Part II: Selecting the Day of the Week (Switch-Case)

  1. Select Day:
    • Choose a day by clicking the corresponding radio button (Day 1 to Day 7) or enter a number directly in the textbox.
  2. Submit Day:
    • Click the Submit Day button to confirm your selection.
  3. Start Simulation:
    • The Start button will be enabled. Click Start to begin the step-by-step execution.
  4. Step Execution:
    • Click Next to proceed through each step of the switch-case code. The output and changes in variables will be shown.
  5. Reset:
    • Click Reset to restart the simulation with a new input.

Note for Mobile Users:

This simulation is optimized for desktop computers with larger screens and mouse interaction. If you access this experiment on a mobile device, please rotate your device to landscape mode for the best experience. Some features may be limited or harder to use on small screens.