WDI Fundamentals Unit 8
flavor and assign it the value to
Note: After declaring (creating) each variable, be sure to check to make sure you've done things correctly by hitting the "Run" button and then typing the variable name (
flavor;in this case) in the "Console" panel and hitting the return/enter key to check its value. You'll want to do this after each step.
numberScoopsand assign it the value
outsideTemperatureand assign it the value
priceand assign it the value
buyIceCreamand set it equal to an expression that incorporates the following:
priceis less than or equal to 2.5 OR
outsideTemperatureis greater than or equal to 70 AND
flavoris equal to
numberScoopsis greater than
buyIceCream;into the console and hit the return/enter key to see whether or not you should buy that delicious chocolate ice cream cone under the given conditions.
Stuck? Check out the solutions for assistance.
Next up we'll look at how we can use the operators we learned in this lesson to add logic to our programs. Here we go!