Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to sum array input.

 
Tracey Morohunfola
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 1274
10
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note to admin, Please move this to the appropriate forum (probably Java general) for a better response,



 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic