• Post Reply Bookmark Topic Watch Topic
  • New Topic

Method Acumulator?  RSS feed

 
Juan Bonilla
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im Creating a case where i have 7 different methods for the different tasks, my first method ask for the input, the second one enters the description, the third one, enters quantity on hand and fourth one does a calculation each method does a validation the other method shoould display the trasactions enter when user says he/she doesnt want to enter more transactions.. but ive come to the problem display method only stores the Last entered transaction, could anyone help me out and tell how to place an accumulator? heres what i've coded:



this is my print method:




any help or hint is kindly apprecciated thanks so much

[Edit - added code tags - see UseCodeTags for details]
 
Campbell Ritchie
Marshal
Posts: 56570
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You would need to explain what you want the accumulator for and what you want it to accumulate. Total price? List of orders?
Have you got an Item class? Why can’t you call its toString method?
Why is that method static? you should only make class members static when there is a good reason. If not, then there might be poor design.
 
Juan Bonilla
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been asked to create a called a method called printo() – An overloaded method to display the total transactions and total inventory cost. It accepts the total transaction count and total inventory cost and returns no value.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!