• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to sum array input.

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.





 
Bartender
Posts: 2911
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Note to admin, Please move this to the appropriate forum (probably Java general) for a better response,



 
An elephant? An actual elephant. Into the apartment. How is the floor still here. Hold this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic