Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
How do I do math questions?
Old
wgb5859
Guest
 
Status:
Posts: n/a
Question How do I do math questions? - 04-07-2009, 11:34 AM

I am trying to make a wizard answer a question that user types in a number. Then the wizard converts the number to a Roman Numeral and says "The number 7 is VII". I have to do this for numbers 1 thru 10. I know it is so type of an if else statement. So far not having any luck. Any help would be appreciated. Please give as much detail as possible.

Thanks for all your help,

confused:
   
Reply With Quote
Old
tamahoc
Guest
 
Status:
Posts: n/a
Default 04-12-2009, 05:19 PM

Basically you need a lot of nested If statements. This is the question from the Tony Gaddis text, right? The basic way to deal with the question is to make an if statement for each whole number between 1-10, so:
if number[variable] = 10 then
wizard say "X",
else
if number[variable] = 9 then
wizard say "IX"
else
...and so on.
number[variable] is input by the user with "ask user for a number" function.

as example:
Attached Files
File Type: a2w romanNum1.a2w (1.07 MB, 24 views)
   
Reply With Quote
reply to Tamahoc
Old
wgb5859
Guest
 
Status:
Posts: n/a
Thumbs up reply to Tamahoc - 04-16-2009, 10:48 AM

Thanks that works great. This Alice stuff is tricky especially with using the out the ordinary math. I greatly appreciate your help. There is nothing in the book that we are using that touches on this topic. The instructor is also not going over anything like this either. You are kind of on your own.
   
Reply With Quote
Reply

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 ©2017, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.