This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with order of output

 
Pisces Iscariot
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..

OUTPUT
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



CODE
 
Henry Wong
author
Marshal
Pie
Posts: 20902
76
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Henry
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic