File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes help converting my code into classes and arrays Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "help converting my code into classes and arrays" Watch "help converting my code into classes and arrays" New topic
Author

help converting my code into classes and arrays

Rob Stevens
Greenhorn

Joined: Oct 26, 2010
Posts: 7
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

Joined: Oct 13, 2005
Posts: 38025
    
  22
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: help converting my code into classes and arrays
 
Similar Threads
get data from website
Eclipse 1.3 and Scanner hasNext()
istream...
Regex and Generics Notes/Questions
also need help this code