Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Wrong output from salesReport, array not filling properly.  RSS feed

 
Edward Strife
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to print out the percentages of total sales and total expenses for each salesperson. For some reason I am only getting the last salespersons name and percentages. Also before my list starts, it outputs all names and the last persons percentages.



The text file (sales.txt) shows:

Smith Kevin
80475 3966.27
Medina Norelis
71040 5677.21
Bailey Van
28305 11276.65
Keepes Karen
58830 7388.15
Keepes Ron
64935 6532.68
Carey Harry
34410 10810.03
Hairy Mata
40515 9954.56
Hurry Mata
52725 8243.62
Hurry Caine
46620 9099.09
Petz Edz
77145 4821.74
 
Campbell Ritchie
Marshal
Posts: 56570
172
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can’t debug a whole class like a “black box”You are going to have to put some debugging code in that class. Get it to print out each line as you fill it. Then you can see what it happening.

And don’t use Float or float. you should really use BigDecimal.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!