I am just learning about App Inventor and I am wanting to create an expenses app. I have a screen which has a text box to input an income amount and a text box to input the income description. and then a button to add the amount and description to the tiny DB.
I also have a text box to input an outgoing amount and another text box to input the outgoing amounts description. I then have a button to add them to the tiny DB.
I am not sure how to make it so that all the incomes add up and then all the outgoings add up so that I can subtract the outgoings from the income to leave a final income amount..
Any help would be great..
Math Blocks. Also It seems like you'll be making use of lists and loops.
It might be simplest to store your outgoing amounts as negative numbers. Then you're always adding the numbers and you don't have to track weather an amount is in or out. Keep a running total showing, and every time you get an amount (in+ or out-) just add that it to the running total.
I would keep each transaction as a list of attributes (amount, description, etc) within a master list. Then just save the list in a single tinyDB tag. Save it every time it gets a new item. Looping will come in when you open the app and get the existing transactions tag from the tinyDB which returns your list of transactions. Use the 'for each item in list' block to loop through and calculate the current totals.
You're next challenge is managing your transaction list. Editing items/removing items. Welcome to the fun!
thanks for the reply greg but everything you mentioned is not making any sense as like i mentioned i am new to app inventor.. I dont know what blocks to add to make a list that increases everytime i add a description and amount..
Here is the way to learn about the App Inventor Blocks Simon ...and it can be fun.
Try the MITs tutorials to learn by doing: http://appinventor.mit.edu/ explore/ai2/tutorials.html
Read the AI2 free online eBook http://www.appinventor.org/ book2 ... the links are at the bottom of the Web page. It explains a lot in fairly plain English and lots of pictures.
Perhaps you would take a little time out from your Expense project and find out how the blocks work?
When you are ready to code expenses return and ask again; you will get specific help.
The block would be add items to list
For sure tho you're going to be deep into handling lists and that does take a little working up to. Run through the tutorials as Steve suggests and keep your project in mind and pay special attention to the list blocks and how they are used as well as the TinyDB and math blocks. You'll likely rethink the code for your expenses app a few times at least as you learn the techniques.
Are you just new to App inventor or new to programming in general. AI is a great way to learn programming concepts.
댓글 없음:
댓글 쓰기