This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Problem with order of output Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Problem with order of output" Watch "Problem with order of output" New topic

Problem with order of output

Pisces Iscariot

Joined: Sep 21, 2005
Posts: 4
Hello.. Ok I have another class file that this method is being called from. Everything compiles fine. There are two problems however.

Firstly, the output comes out in the wrong order. I need it to be High Risk, Medium Risk, then Low Risk. Also, there is a tenth person who just doesn't show up! The array in which she exists is perfect and I see absolutely no reason she should be in this list. She is the first in all of the arrays, which may or may not have anything to do with the problem. Thanks for any help..

Patients with a Low Health Risk
Sue James... Weight: 54.47736Kg - Height: 1.651m - BMI: 19.99 - Age: 27
Bruce Gray... Weight: 60.51024Kg - Height: 1.5748m - BMI: 24.4 - Age: 59
Janet Parker... Weight: 66.906Kg - Height: 1.8288m - BMI: 20 - Age: 69
Stan Terrance... Weight: 68.99256Kg - Height: 1.7018m - BMI: 23.82 - Age: 79
Moe Greary... Weight: 74.07288000000001Kg - Height: 1.7526m - BMI: 24.12 - Age: 41
Kerry Robson... Weight: 77.15736Kg - Height: 1.8034m - BMI: 23.72 - Age: 55

Patients with a High Health Risk
Larry Ovid... Weight: 84.55104Kg - Height: 1.778m - BMI: 26.75 - Age: 63

Patients with a Medium Health Risk
Paul Dresser... Weight: 90.35712Kg - Height: 1.8796m - BMI: 25.58 - Age: 57
Ethan Rome... Weight: 99.792Kg - Height: 1.7526m - BMI: 32.49 - Age: 46

Henry Wong

Joined: Sep 28, 2004
Posts: 20162

There is nothing in your code that does anything with ordering. In fact, if it is unordered, you headings printouts will be wrong.

I am assuming that the ordering is done elsewhere. That is probably a good place to look.


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
I agree. Here's the link:
subject: Problem with order of output
It's not a secret anymore!