Continued = In the first section o of the nested block, add code t to state “That is too few characters.” q In the second se ec tion of the nested block, add code to state “That is too many characters,” as s sh own. Since the equal to and les ss than conditions have already been accounted for, the t only other possible condition n is that the length of the variable is greater than 6. T Th is can be addressed with the E EL SE part of the nested block without using any opera at ors. when clicked ask Enter a six-character password. and wait say answer . join join You entered set to textLength answer length of else if then = 6 textLength else if then 6 textLength say That is too few characters. say That is too many characters. say answer . join join Your password is Goodheart-Willcox Publisher w Click the Green Flag button to run the program. Run it several times, and test for passwords of different f lengths. e Save project as H HO E05-03C in your working folder.e Try It! Create a project t that calculates how much pow we r is used in kilowatts by an equivalent compact fluorescent n lamp (CFL) or light emitting d di ode (LED) lightbulb if the user enters the wattage for an in nc andescent bulb. The user should choose between CFL and LED. Assume a CFL uses 25 percent of the power of an incandescent n bulb and an LED bulb uses 20 percent. How w is nesting used in your projec ct ? Save the project as TI05-03C in your working folder. Green Flag Copyright Goodheart-Willcox Co., Inc. Chapter 5 Decisions 115
Previous Page Next Page