Skip to content

Commit d48e121

Browse files
committed
consistent whitespace
1 parent 2b9b3d6 commit d48e121

File tree

7 files changed

+46
-46
lines changed

7 files changed

+46
-46
lines changed

ch04/Exercise.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
public class Exercise {
2-
2+
33
public static void zoop() {
44
baffle();
55
System.out.print("You wugga ");
66
baffle();
77
}
8-
8+
99
public static void main(String[] args) {
1010
System.out.print("No, I ");
1111
zoop();
1212
System.out.print("I ");
1313
baffle();
1414
}
15-
15+
1616
public static void baffle() {
1717
System.out.print("wug");
1818
ping();
1919
}
20-
20+
2121
public static void ping() {
2222
System.out.println(".");
2323
}
24-
24+
2525
}

ch04/Methods.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public static void main(String[] args) {
1313
double radians = Math.toRadians(180.0);
1414
double degrees2 = Math.toDegrees(Math.PI);
1515
long x = Math.round(Math.PI * 20.0);
16-
16+
1717
double x2 = Math.cos(angle + Math.PI / 2.0);
1818
double x3 = Math.exp(Math.log(10.0));
1919
double x4 = Math.pow(2.0, 10.0);

ch05/Conditional.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,33 @@
44
* Examples from Chapter 5.
55
*/
66
public class Conditional {
7-
7+
88
public static void main(String[] args) {
99
String fruit1 = "Apple";
1010
String fruit2 = "Orange";
1111
System.out.println(fruit1.equals(fruit2));
12-
12+
1313
int x = 17;
1414
int n = 18;
15-
15+
1616
if (x > 0) {
1717
System.out.println("x is positive");
1818
}
19-
19+
2020
if (x % 2 == 0) {
2121
System.out.println("x is even");
2222
} else {
2323
System.out.println("x is odd");
2424
}
25-
25+
2626
if (x > 0) {
2727
System.out.println("x is positive");
2828
} else if (x < 0) {
2929
System.out.println("x is negative");
3030
} else {
3131
System.out.println("x is zero");
3232
}
33-
33+
3434
if (x == 0) {
3535
System.out.println("x is zero");
3636
} else {
@@ -40,17 +40,17 @@ public static void main(String[] args) {
4040
System.out.println("x is negative");
4141
}
4242
}
43-
43+
4444
boolean evenFlag = (n % 2 == 0); // true if n is even
4545
boolean positiveFlag = (x > 0); // true if x is positive
46-
46+
4747
if (evenFlag) {
4848
System.out.println("n was even when I checked it");
4949
}
50-
50+
5151
if (!evenFlag) {
5252
System.out.println("n was odd when I checked it");
5353
}
5454
}
55-
55+
5656
}

ch05/Exercise.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
public class Exercise {
2-
2+
33
public static void zoop(String fred, int bob) {
44
System.out.println(fred);
55
if (bob == 5) {
@@ -8,21 +8,21 @@ public static void zoop(String fred, int bob) {
88
System.out.println("!");
99
}
1010
}
11-
11+
1212
public static void main(String[] args) {
1313
int bizz = 5;
1414
int buzz = 2;
1515
zoop("just for", bizz);
1616
clink(2 * buzz);
1717
}
18-
18+
1919
public static void clink(int fork) {
2020
System.out.print("It's ");
2121
zoop("breakfast ", fork) ;
2222
}
23-
23+
2424
public static void ping(String strangStrung) {
2525
System.out.println("any " + strangStrung + "more ");
2626
}
27-
27+
2828
}

ch05/Logarithm.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import java.util.Scanner;
22

33
public class Logarithm {
4-
4+
55
public static void main(String[] args) {
66
System.out.println("printLogarithm");
77
printLogarithm(3.0);
8-
8+
99
System.out.println("scandouble");
1010
scanDouble();
11-
11+
1212
System.out.println("scandouble2");
1313
scanDouble2();
1414
}
15-
15+
1616
public static void printLogarithm(double x) {
1717
if (x <= 0.0) {
1818
System.err.println("Error: x must be positive.");
@@ -21,14 +21,14 @@ public static void printLogarithm(double x) {
2121
double result = Math.log(x);
2222
System.out.println("The log of x is " + result);
2323
}
24-
24+
2525
public static void scanDouble() {
2626
Scanner in = new Scanner(System.in);
2727
System.out.print("Enter a number: ");
2828
double x = in.nextDouble();
2929
printLogarithm(x);
3030
}
31-
31+
3232
public static void scanDouble2() {
3333
Scanner in = new Scanner(System.in);
3434
System.out.print("Enter a number: ");
@@ -40,5 +40,5 @@ public static void scanDouble2() {
4040
double x = in.nextDouble();
4141
printLogarithm(x);
4242
}
43-
43+
4444
}

ch05/Recursion.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
public class Recursion {
2-
2+
33
public static void main(String[] args) {
44
System.out.println("countdown");
55
countdown(3);
6-
6+
77
System.out.println("countup");
88
countup(3);
9-
9+
1010
System.out.println("newLine");
1111
newLine();
12-
12+
1313
System.out.println("nLines");
1414
nLines(3);
15-
15+
1616
System.out.println("threeLine");
1717
threeLine();
18-
18+
1919
System.out.println("displayBinary");
2020
displayBinary(23);
2121
System.out.println();
2222
}
23-
23+
2424
public static void countdown(int n) {
2525
if (n == 0) {
2626
System.out.println("Blastoff!");
@@ -29,29 +29,29 @@ public static void countdown(int n) {
2929
countdown(n - 1);
3030
}
3131
}
32-
32+
3333
public static void newLine() {
3434
System.out.println();
3535
}
36-
36+
3737
public static void threeLine() {
3838
newLine();
3939
newLine();
4040
newLine();
4141
}
42-
42+
4343
public static void nLines(int n) {
4444
if (n > 0) {
4545
System.out.println();
4646
nLines(n - 1);
4747
}
4848
}
49-
49+
5050
public static void forever(String s) {
5151
System.out.println(s);
5252
forever(s);
5353
}
54-
54+
5555
public static void countup(int n) {
5656
if (n == 0) {
5757
System.out.println("Blastoff!");
@@ -60,12 +60,12 @@ public static void countup(int n) {
6060
System.out.println(n);
6161
}
6262
}
63-
63+
6464
public static void displayBinary(int value) {
6565
if (value > 0) {
6666
displayBinary(value / 2);
6767
System.out.print(value % 2);
6868
}
6969
}
70-
70+
7171
}

ch06/Exercise.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
public class Exercise {
2-
2+
33
public static void main(String[] args) {
44
boolean flag1 = isHoopy(202);
55
boolean flag2 = isFrabjuous(202);
@@ -12,7 +12,7 @@ public static void main(String[] args) {
1212
System.out.println("pong!");
1313
}
1414
}
15-
15+
1616
public static boolean isHoopy(int x) {
1717
boolean hoopyFlag;
1818
if (x % 2 == 0) {
@@ -22,7 +22,7 @@ public static boolean isHoopy(int x) {
2222
}
2323
return hoopyFlag;
2424
}
25-
25+
2626
public static boolean isFrabjuous(int x) {
2727
boolean frabjuousFlag;
2828
if (x > 0) {
@@ -32,5 +32,5 @@ public static boolean isFrabjuous(int x) {
3232
}
3333
return frabjuousFlag;
3434
}
35-
35+
3636
}

0 commit comments

Comments
 (0)