Code:
import java.io.*;
import java.util.*;
import cs1.Keyboard;
public class chore {
private int choreNum;
private int cost;
private ArrayList<Integer> dependencies;
public chore(int number) {
choreNum = number;
dependencies = new ArrayList<Integer>();
System.out.println("Enter time for chore " + (choreNum + 1));
cost = Keyboard.readInt();
if (number == 0)
dependencies.add(0);
else {
System.out.println("tEnter any dependencies or 0 to stop");
boolean keepGoing = true;
Integer input;
while (keepGoing) {
input = Keyboard.readInt();
dependencies.add(input - 1);//the index of the first process is 0, so the user sees process n as process n+1. correct for that by subtracting 1 here.
if (input.equals((Integer) 0))
keepGoing = false;
}
}
}
public int getCost() {
return cost;
}
public int getChoreNum() {
return choreNum;
}
public int getArg(int index) {
int f = dependencies.get(index);
return f;
}
public int getArgsSize() {
return dependencies.size();
}
public static void main(String[] args) {
System.out.println("This doesn't do anything. Run the chores file instead.");
}
}