Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Beginning Java and the fly likes Trying to print contents of object filled array list. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Trying to print contents of object filled array list." Watch "Trying to print contents of object filled array list." New topic
Author

Trying to print contents of object filled array list.

Edward Strife
Greenhorn

Joined: Mar 15, 2012
Posts: 14
I am trying to print a sales report with each members name and their percentage of sales and expenses. I should be using a loop that runs the length of the sales list and use next() method to get each salesperson and then my observer methods to return the information about the salesperson. Something isn't right.

E Armitage
Rancher

Joined: Mar 17, 2012
Posts: 888
    
    9
Something isn't right.


What happens when you try to compile/run the program?
Edward Strife
Greenhorn

Joined: Mar 15, 2012
Posts: 14
I only get the sales total and expense total, however I have tried numerous ways to print each person with their percentages to no avail.
E Armitage
Rancher

Joined: Mar 17, 2012
Posts: 888
    
    9
You should write a loop that goes through the values in your SortedList
Winston Gutkowski
Bartender

Joined: Mar 17, 2011
Posts: 7501
    
  18

Winston Gutkowski wrote:Have one class that converts data to a List of SalesPersons...

It also occurred to me that what you probably actually want is a java.util.Set<SalesPerson>. That way, you ensure that your report data doesn't contain any duplicates.

Winston


Isn't it funny how there's always time and money enough to do it WRONG?
Articles by Winston can be found here
 
 
subject: Trying to print contents of object filled array list.
 
Similar Threads
Creating Objects without the "New" Keyword
Unable to add object to array.
Comparator
ArrayList selection Sort
Wrong output from salesReport, array not filling properly.