Alice Community  

Go Back   Alice Community > General Discussion > The Lounge

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
If/Else assignment
Old
bsmill04
Guest
 
Status:
Posts: n/a
Default If/Else assignment - 03-03-2009, 02:49 PM

This assignment had me make a bar scene with 2 people. The first person walks in and heads to the bar. The bartender asks the age of the girl. If the girl enters 21 then the bartender says welcome to the exclusive bar. If the user enters 22 or higher then the bartender says she is too old to drink. If the user enters 20 or lower the bartender says she is too young to drink.

I used 1 if/else statement for the 21 portion. I added another if/else statement into the else portion of the first if/else to run the 22 or higher or 20 or lower part of the assignment. It was really quite simple once I realized i could add if/else statements together.
   
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.