Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

help converting my code into classes and arrays

 
Rob Stevens
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so i know this code is still pretty rough but i need convert this code into classes and arrays. i unfortunately dont know how to do that so i was hoping for some advice.
here is my current code:

here is the file scanned in:



how do i scan in these strings in and store them in arrays and change "head" and "dependents" into classes?

(this code got posted at http://www.programmersheaven.com/mb/java_beginners/419488/419488/converting-my-current-code-to-classes-and-arrays/?S=B20000#419488 by accident and i cant figure out how to remove it. the website is buggy and auto submitted it before i could delete it)
 
Campbell Ritchie
Sheriff
Pie
Posts: 50246
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You would need to create a HeadOfHousehold and a DependentInHousehold class; maybe both have a Person field. You could have a HeadOfHousehold field in the dependent class and a dependent[] (or, maybe better, a List<DependentInHousehold>) field in the HeadOfHousehold class.
Design your head and dependent classes before you try to put the whole thing together. What you have might be incompatible with those two classes, so you may find you have to lose a lot of what you have already written.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic