How do I make a list which has variables and can do math in it?

131 views
Skip to first unread message

Karan Sanghavi

unread,
Feb 7, 2015, 6:43:59 AM2/7/15
to mitappinv...@googlegroups.com
I am trying to make an app that changes the number of computers when a 'reserve' or cancel' button is clicked. When the reserve button is clicked the number of computers is decremented by one and vice versa for the cancel button. This is repeated for a number of rooms which are going to be on separate pages. This list does not have to be stored for multiple sessions but it is preferable if it is.I realize that I have to make a list but I have no idea how to go about it and am really confused.

Thanking You,
Karan Sanghavi

Ghica

unread,
Feb 7, 2015, 7:46:15 AM2/7/15
to mitappinv...@googlegroups.com
Ah!!! the school assignment to make computer reservations in rooms!
Maybe search this forum for answers? And go to the documentation about lists and about TinyDB if you have to pass a list from one screen to the next?
Cheers, Ghica.

SteveJG

unread,
Feb 7, 2015, 8:42:56 AM2/7/15
to mitappinv...@googlegroups.com
How to Reserve Computers Complete - Questions and Answers on the AI2 Forum about the Mechanics of Coding a Complex Problem

Advice for the poor lost souls trying to complete a school assignment and the hints that have been provided so far:





It appears ALL the algorithms needed to complete this assignment are either posted on the forum or are discussed in the free online AI2 eBook here: http://www.appinventor.org/book2  

There is a problem.  Many of the coding solutions/examples do not look exactly like a way to manage computer reservations (some manage theater seats) and use maps to locate museums or buildings on school campuses or how to use AI2 to make complex decisions.   You need to read and adjust the examples that are available to your situation and by doing so, you will learn to code well.  "Maps" can be made using images of the buildings on a Canvas.BackgroundImage and using hot spots   OR    you can use Image sprites of the buildings (perhaps numerals as the image) to locate the building or you could use Vertical and Horizontal arrangements to place buttons of various sizes on the screen representing buildings in a cartoon of their locations (you can adjust the height and width of the buttons using code or the Properties in the Designer screen.)   Unfortunately all the buildings will have to be rectangles or circles    Your imagination is your best friend.

The assignment is not impossible, just complicated.    Break it down into four or five projects that do a piece of the assignment.   When you understand how you solved the issues of all the pieces required, re-write the code into a new project.   Have you learned to search in the forum for key words?     You can also search on the Internet using a combination   of     App Inventor + your search term   or AI2 and the terms.  There is lots of technical help available to help understand published algorithms and how they can be used with Ai2 to achieve your goals.

Do NOT make the mistake of using LOTS of screens ..the more screens you use, the more difficult this app assignment becomes (sooner or later you are going to have to pass lots of variables between screens using a TinyDB or other methods and that gets messy).

Do make frequent backups of your work.  Really!     The forum is starting to get pleas from users who exceeded the 5Mb aia limit, used more than ten screens etc to help fix their projects because the  projects that compiled yesterday do not compile today.

Save frequently aia's (when you know your code is working ..give them different version names)   and/or  save a second copy of your project to the MIT server by   Projects >  Save project as...  Why?   When you get stuck, are tired and have done something that messes up your project, you can return to a clean version of the project and smile :)       Realize, AI2 has no un-do feature.    Code smart.  Try to avoid long sessions of coding in a panic, getting tired and messing up all the good work you have so far achieved.

Some schools prohibit their students from posting blocks and asking for help in fixing issues.   If that is your school's requirement, you got to live with it.   Other schools permit discussions of material...a great way to learn ... REAL programmers do not work in a vacuum, they seek advice of books and their colleagues and the ciders learn from the suggestions provided.   Forum members will provide suggestions, but won't do your homework.  You got to learn to program.   A good friend is the DoIt debugger that is part of AI2; learn to use it, you will not loose points by asking the debugger to help you.

Best of luck and create some luck of your own by coding smart.   Please save your work frequently (with a different name each time).

Regards,
Steve
Reply all
Reply to author
Forward
0 new messages