Skip to content

Commit 5be6716

Browse files
authored
Merge pull request #27 from HarryDulaney/Add_Chapter_22_23_24_25_answers
Fixed Exercise14_17.java, added import for FXMLLoader + Removed JUnit…
2 parents de31a21 + 40712f8 commit 5be6716

File tree

5 files changed

+28
-13
lines changed

5 files changed

+28
-13
lines changed

ch_08/Exercise08_13.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
package ch_08;
22

3-
import org.junit.Test;
4-
5-
import java.awt.*;
63
import java.util.*;
74

85
/**
@@ -52,4 +49,4 @@ public static int[] locateLargest(double[][] a) {
5249
}
5350
return largeIdx;
5451
}
55-
}
52+
}

ch_14/Exercise14_17.java

+6-8
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
package ch_14.exercise14_17;
1+
package ch_14;
22

33
import javafx.application.Application;
4-
import javafx.collections.ObservableList;
5-
import javafx.scene.Node;
4+
import javafx.fxml.FXMLLoader;
5+
import javafx.scene.Parent;
66
import javafx.scene.Scene;
7-
import javafx.scene.layout.Pane;
8-
import javafx.scene.paint.Color;
9-
import javafx.scene.shape.Arc;
10-
import javafx.scene.shape.Circle;
11-
import javafx.scene.shape.Line;
127
import javafx.stage.Stage;
138

9+
import java.io.FileInputStream;
10+
import java.io.IOException;
11+
1412
/**
1513
* 14.17 (Game: hangman) Write a program that displays a drawing for the popular hangman game, as shown in Figure 14.48a.
1614
*/

ch_18/Exercise18_01.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import java.math.BigInteger;
44
import java.util.Scanner;
55

6-
import static org.junit.Assert.*;
6+
import static resources.lib.UnitTest.*;
77

88
/**
99
* *18.1 (Factorial) Using the BigInteger class introduced in Section 10.9, you can

resources/lib/UnitTest.java

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package resources.lib;
2+
3+
import java.math.BigInteger;
4+
5+
public class UnitTest {
6+
7+
public static void assertEquals(BigInteger b1, BigInteger b2) {
8+
if (!b1.equals(b2)) {
9+
throw new UnitTestException("Failed Unit Test, Expected: " + b1 + ", but got: " + b2);
10+
}
11+
}
12+
}

resources/lib/UnitTestException.java

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package resources.lib;
2+
3+
public class UnitTestException extends AssertionError {
4+
5+
public UnitTestException(Object detailMessage) {
6+
super(detailMessage);
7+
}
8+
}

0 commit comments

Comments
 (0)