File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes GWT and the fly likes How to sum array input. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » GWT
Bookmark "How to sum array input." Watch "How to sum array input." New topic
Author

How to sum array input.

Tracey Morohunfola
Greenhorn

Joined: Sep 10, 2010
Posts: 3
Hi all,

I'm new in java and creating a java prog that will display cost of BREAKFAST, LUNCH, and DINNER


The below code is how I have gone so far



My first question is
How do I let this program run accepting input from 3 users with the click on my ADD button to display in the textarea. It runs now but only display my first set of input 3 times

(NOW)
Cost of breakfast=5.50 Cost of lunch=4.80 Cost of dinner=3.50
Cost of breakfast=5.50 Cost of lunch=4.80 Cost of dinner=3.50
Cost of breakfast=5.50 Cost of lunch=4.80 Cost of dinner=3.50

(BUT I WANT)
Cost of breakfast=5.50 Cost of lunch=4.80 Cost of dinner=7.50
Cost of breakfast=7.50 Cost of lunch=9.00 Cost of dinner=6.00
Cost of breakfast=13.00 Cost of lunch=4.50 Cost of dinner=13.50

Question 2:
How do I do get to display with the RESULT button just below the 2D array in the textarea
1. the sum of the amount spent on LUNCH by the 3 users and
2. also the average spent by each person on the 3 meal

Thanks alot.





salvin francis
Ranch Hand

Joined: Jan 12, 2009
Posts: 928

Note to admin, Please move this to the appropriate forum (probably Java general) for a better response,




My Website: [Salvin.in] Cool your mind:[Salvin.in/painting] My Sally:[Salvin.in/sally]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to sum array input.