Page 138 - KEC Khaitan C5 Flipbook
P. 138

if (!isRaining) {

                      setText("outputLabel", "Go outside, it's clear!");

                  } else {

                      setText("outputLabel", "Stay dry!");
                  }

                  });

















                  Note: To perform it, add label, checkbox and button in design mode.




                            INPUT-PROCESS-OUTPUT (IPO) MODEL IN PROJECTS

                  The IPO model helps structure programs by breaking them into three main parts:

                     Input: Collecting user data (e.g., typing a name or clicking a button).

                     Process: Performing calculations or logic based on the input.

                     Output: Displaying results to the user.

                  BUILDING APPS WITH VARIABLES AND CONDITIONS

                  In App Lab, we can create functional apps using variables and conditional logic. Some
                  project ideas include:

                     Quiz App: Store user answers in variables and check if they are correct.

                     Simple Game: Keep track of a player’s score and decide if they win or lose.

                     Weather  App: Take user input  (temperature) and display a message  based  on
                    conditions.

                  Example: Quiz App Code

                  onEvent("button1", "click", function() {

                      var answer = getText("inputBox");

                      if (answer == "Paris") {

                              setText("resultLabel", "Correct!");


                  136   Premium Edition-V
   133   134   135   136   137   138   139   140   141   142   143