Fixed issue with the 0 option not solving all problems

This commit is contained in:
2020-06-08 01:23:32 -04:00
parent 52c416aa54
commit 534e1ed688

View File

@@ -83,10 +83,10 @@ public class Driver{
//This selection solves all problems in order
if(problemNumber.equals(0)){
//Solve to every valid problem number, skipping over 0
for(Integer problemLocation = 1;problemLocation < PROBLEM_NUMBERS.size();++problemLocation){
//Solve the problem
for(Integer problemLocation = PROBLEM_NUMBERS.get(1);problemLocation < PROBLEM_NUMBERS.size();++problemLocation){
//Solve the problems
System.out.print(PROBLEM_NUMBERS.get(problemLocation).toString() + ". ");
solveProblem(problemLocation);
solveProblem(PROBLEM_NUMBERS.get(problemLocation));
}
}
//This is if a single problem number was chosen
@@ -99,8 +99,7 @@ public class Driver{
//Get the problem
Problem problem = getProblem(problemNumber);
//Print the problem description
String description = problem.getDescription();
System.out.println(description);
System.out.println(problem.getDescription());
//Solve the problem
problem.solve();
//Print the results
@@ -153,10 +152,10 @@ public class Driver{
//If the problem number is 0 print out all the descriptions
if(problemNumber.equals(0)){
//Print description for every valid problem number, skipping over 0
for(Integer problemLocation = PROBLEM_NUMBERS.get(1);problemLocation < PROBLEM_NUMBERS.size();++problemLocation){
for(Integer problemLocation = 1;problemLocation < PROBLEM_NUMBERS.size();++problemLocation){
//Print the problem's description
System.out.print(PROBLEM_NUMBERS.get(problemLocation) + ". ");
printDescription(problemLocation);
printDescription(PROBLEM_NUMBERS.get(problemLocation));
System.out.println();
}
}