1
Java / Re: Programming Help!
« on: November 30, 2011, 02:56:57 pm »
Ok I got it I just had to change the regiment class and implement it on the army class. I'll come back if I need more help. Thanks again!
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
public static void main(String[] args) throws IOException {
Army superArmy = new Army();
Scanner fileScan = new Scanner(new File("regiments.txt"));
while (fileScan.hasNext()) // while not eof
{
int regimentNumber = fileScan.nextInt();
String name = fileScan.next();
int men = 1000;
Regiment next = new Regiment(regimentNumber, name, men);
superArmy.AddRegiment(next);
}
superArmy.PrintList();
}
public void PrintList() {
for (int i = 0; i < regiment.size(); i++) {
Regiment more = regiment.get(i);
System.out.println("Regiment Number: " + "[" + more.getRegimentNumber() + "]"
+ " Regiment Name: " + "[" + more.getName() + "]"
+ " Number Of Men: " + "[" + more.getNumberOfMen() + "]");
}
}