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)
- 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.
- 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.
- Confirm Selection:
- Click the Ok button to confirm your code selection.
- Start Simulation:
- The Start button will be enabled. Click Start to begin the step-by-step execution.
- Step Execution:
- Click Next to proceed through each step of the code. The current state of variables and reasoning will be displayed.
- Stop/Reset:
- Click Stop to abort and reset the simulation at any time.
Part II: Selecting the Day of the Week (Switch-Case)
- Select Day:
- Choose a day by clicking the corresponding radio button (Day 1 to Day 7) or enter a number directly in the textbox.
- Submit Day:
- Click the Submit Day button to confirm your selection.
- Start Simulation:
- The Start button will be enabled. Click Start to begin the step-by-step execution.
- Step Execution:
- Click Next to proceed through each step of the switch-case code. The output and changes in variables will be shown.
- 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.