QUESTION IMAGE
Question
Question was provided via image upload.
Identify the task requirements
The task asks us to complete "Milestone 1" in a Code.org App Lab environment. We need to get the user input values from the screen elements and assign them to the appropriate variables declared at the top of the program: stress, happiness, and time.
Analyze the instructions
The instructions state:
- Use
getText()andgetNumber()to assign the user input for their stress level to the variablestress. - The example given is:
stress = getNumber("stressSlider");(or similar UI element ID). - Follow the same pattern for the variables
happinessandtime.
Determine the correct code statements
Using Code.org App Lab and Variable Assignment concepts:
- For
stress, we retrieve a numeric value from the slider:
stress = getNumber("stressSlider");
- For
happiness, we retrieve a numeric value from the corresponding slider or input:
happiness = getNumber("happinessSlider");
- For
time, we retrieve a numeric value from the input field:
time = getNumber("timeInput");
(Note: Exact UI element IDs like "stressSlider", "happinessSlider", and "timeInput" are standard in this Code.org curriculum template).
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
To complete Milestone 1, write the following variable assignment statements inside the onEvent block:
stress = getNumber("stressSlider");
happiness = getNumber("happinessSlider");
time = getNumber("timeInput");