Alice Community double digits

 double digits
 supfreshourturnbaby Guest   Status: Posts: n/a double digits - 10-29-2009, 01:09 PM How do I make it so that (using the calculator object) I can click for example, 1, then 2 , and it will store that as 12, and then click add and then 5, and the answer will display as 17.I can click 1-9 and make them add, divide, multiply and subtract, but double digits is proving to be a bit of a challenge.
 xxledzeppelin2x3 Guest   Status: Posts: n/a 10-29-2009, 04:18 PM uhmm im not sure if this is what you mean, but for example if you have bunny move up 1 meter, click on the 1 meter, then click on other,type for example 7meters, then click the 7 after you hit ok,then click math, then click +,-,*, or /, then click other and type the number you want it to be -,+,*,or / by! It doesnt show the answer in the line of code it will show for example ( 7 / 2.2 )and it will automatically do the math when you click play. sorry for making what i just said so hard to understand but i have to go so i cant check over it sorry, Trevor by the way tell me if it works for you, or if i didnt even answer what you were asking
 x2495iiii Super Moderator     Status: Offline Posts: 3,508 Join Date: Dec 2008 Location: Somewhere in the Continental U.S. 10-29-2009, 11:52 PM Here's what you need to do if all you want to do is perform those four simple mathematic operations: -create three number variables under the world, one called num1, one called num2, and one called finalNum. Set their initial values to 0 -create five boolean variables: addYN, subYN, mulYN, divYN, and numMove. Set all of them to false. -write a method under the world called numberCheck which is called whenever any of the number buttons are clicked and which passes the number clicked as a parameter (if mouse is clicked on numButton3, world.numberCheck [number == 3]). The method should look like this: if world.numMove (do nothing, for now) else if world.num1 == 0 num1 set value to (the number the user clicked on) else num1 set value to (num1 * 10) + (the number the user clicked on) -write an event which sets numMove to true when the add, subtract, multiply and divide are pressed, and sets the corresponding boolean variable to true as well (the add button makes addYN true, etc.) -now, go back to the numCheck method, and put this in the first part of the first if/else if statement (the one that checks to see if numMove is true) if world.numMove if num2 == 0 num2 set value to (the number the user clicked on) else num2 set value to (num2 * 2) + (the number the user clicked on) -Finally, write a method which is called when the equals button is pressed called calculate, which looks like this: if addYN finalNum set value to num1 + num2 else if subYN finalNum set value to num1 - num2 else if mulYN finalNum set value to num1 * num2 else if divYN finalNum set value to num1 / num2 Now I haven't tested this code, so there might be a few bugs, but I spent a lot of time thinking about it, so it should work. Let me know if there are any problems, alright? (')>
 supfreshourturnbaby Guest   Status: Posts: n/a 10-30-2009, 12:52 PM I havent tried either yet, but will get back to you both as soon as I do, thanks for the input
 xxledzeppelin2x3 Guest   Status: Posts: n/a 10-30-2009, 03:11 PM yehhh maybe what x2495iiii said ! sorry im not an expert at alice but i like to try and help people out with what i know ! or at least what i think i know

 Thread Tools Display Modes Linear Mode

 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 Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements     Community News and Announcements Alice 3     How Do I?     Works In Progress     Share Your World     Share Custom Classes     Bugs and Trouble Shooting     Suggestion Box Alice 2     How do I...?     Works-In-Progress     Share Worlds     Share Objects     Bugs and Troubleshooting     Suggestion Box Educators     Teaching with Alice     Teaching Using Alice 3     Teaching Using Alice 2     CS Principles and Alice     AP CSA and Intro to Java and Alice     Workshops     Alice Player and VR General Discussion     Questions and Comments     The Lounge