Multiple Operators in the same line? Decision Maker App Unit 4 Lesson 12

My student is having trouble. Her app gives a time to go to sleep based on the day of the week and the amount of hours a person has to sleep. She wants kids to be able to sleep less on the weekend - Saturday-Sunday 3-7 hours - and is wondering if she can code using Saturday && Sunday && 3 hours - 7 hours .

Any advice? I am stuck with her. Thanks!

@patience.blythe ,

Welcome to the forum! I took a look at your student’s code. I think they just need to move the parenthesis around a little …

Can they perhaps group the days of the week inside one set of parenthesis and then use the && and then group the two hour comparisons inside a 2nd set of parenthesis?

They may also want to consider what event triggers the display. Right now, they could enter the day and the # of hours and nothing will happen until they go back and click on the day again… They may want to make a button that “submits” their data entries and then calculates the bedtime!

Good luck! Looks like a useful app!


Thank you so much!!! We will try that. xx P