Skip to content

Commit 1340ba0

Browse files
committed
consistent whitespace
1 parent 2dd19cc commit 1340ba0

File tree

3 files changed

+35
-35
lines changed

3 files changed

+35
-35
lines changed

ch06/Series.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public static double absoluteValue(double x) {
7070

7171
/**
7272
* Tests whether x is a single digit integer.
73-
*
73+
*
7474
* @param x the integer to test
7575
* @return true if x has one digit, false otherwise
7676
*/

ch07/Loops.java

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

33
public class Loops {
4-
4+
55
public static void countdown(int n) {
66
while (n > 0) {
77
System.out.println(n);
88
n = n - 1;
99
}
1010
System.out.println("Blastoff!");
1111
}
12-
12+
1313
public static void sequence(int n) {
1414
while (n != 1) {
1515
System.out.println(n);
@@ -20,7 +20,7 @@ public static void sequence(int n) {
2020
}
2121
}
2222
}
23-
23+
2424
public static double scanDouble() {
2525
Scanner in = new Scanner(System.in);
2626
boolean okay;
@@ -37,7 +37,7 @@ public static double scanDouble() {
3737
double x = in.nextDouble();
3838
return x;
3939
}
40-
40+
4141
public static double scanDouble2() {
4242
Scanner in = new Scanner(System.in);
4343
while (true) {
@@ -51,7 +51,7 @@ public static double scanDouble2() {
5151
double x = in.nextDouble();
5252
return x;
5353
}
54-
54+
5555
public static double addNumbers() {
5656
Scanner in = new Scanner(System.in);
5757
int x = -1;
@@ -66,13 +66,13 @@ public static double addNumbers() {
6666
}
6767
return sum;
6868
}
69-
69+
7070
public static void main(String[] args) {
7171
System.out.println("countdown");
7272
countdown(3);
73-
73+
7474
System.out.println("sequence");
7575
sequence(10);
7676
}
77-
77+
7878
}

ch07/Tables.java

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Examples from Chapter 7.
33
*/
44
public class Tables {
5-
5+
66
public static void example() {
77
int i = 1;
88
while (i < 10) {
@@ -11,7 +11,7 @@ public static void example() {
1111
i = i + 1;
1212
}
1313
}
14-
14+
1515
public static void example2() {
1616
int i = 1;
1717
while (i < 10) {
@@ -20,7 +20,7 @@ public static void example2() {
2020
i = i + 1;
2121
}
2222
}
23-
23+
2424
public static void example3() {
2525
final double LOG2 = Math.log(2);
2626
int i = 1;
@@ -30,7 +30,7 @@ public static void example3() {
3030
i = i * 2;
3131
}
3232
}
33-
33+
3434
public static void example4() {
3535
int i = 1;
3636
while (i <= 6) {
@@ -39,7 +39,7 @@ public static void example4() {
3939
}
4040
System.out.println();
4141
}
42-
42+
4343
public static void printRow() {
4444
int i = 1;
4545
while (i <= 6) {
@@ -48,7 +48,7 @@ public static void printRow() {
4848
}
4949
System.out.println();
5050
}
51-
51+
5252
public static void printRow2(int n) {
5353
int i = 1;
5454
while (i <= 6) {
@@ -57,31 +57,31 @@ public static void printRow2(int n) {
5757
}
5858
System.out.println();
5959
}
60-
60+
6161
public static void example5() {
6262
int i = 1;
6363
while (i <= 6) {
6464
printRow2(i);
6565
i = i + 1;
6666
}
6767
}
68-
68+
6969
public static void printTable() {
7070
int i = 1;
7171
while (i <= 6) {
7272
printRow2(i);
7373
i = i + 1;
7474
}
7575
}
76-
76+
7777
public static void printTable2(int rows) {
7878
int i = 1;
7979
while (i <= rows) {
8080
printRow2(i);
8181
i = i + 1;
8282
}
8383
}
84-
84+
8585
public static void printRow3(int n, int cols) {
8686
int i = 1;
8787
while (i <= cols) {
@@ -90,66 +90,66 @@ public static void printRow3(int n, int cols) {
9090
}
9191
System.out.println();
9292
}
93-
93+
9494
public static void printTable3(int rows) {
9595
int i = 1;
9696
while (i <= rows) {
9797
printRow3(i, rows);
9898
i = i + 1;
9999
}
100100
}
101-
101+
102102
public static void printTable4(int rows) {
103103
for (int i = 1; i <= rows; i = i + 1) {
104104
printRow3(i, rows);
105105
}
106106
}
107-
107+
108108
public static void printRow4(int n, int cols) {
109109
int i;
110110
for (i = 1; i <= cols; i = i + 1) {
111111
System.out.printf("%4d", n * i);
112112
}
113113
System.out.println(i);
114114
}
115-
115+
116116
public static void main(String[] args) {
117117
System.out.println("example");
118118
example();
119-
119+
120120
System.out.println("example2");
121121
example2();
122-
122+
123123
System.out.println("example3");
124124
example3();
125-
125+
126126
System.out.println("example4");
127127
example4();
128-
128+
129129
System.out.println("example5");
130130
example5();
131-
131+
132132
System.out.println("printRow");
133133
printRow();
134-
134+
135135
System.out.println("printRow2");
136136
printRow2(6);
137-
137+
138138
System.out.println("printTable");
139139
printTable();
140-
140+
141141
System.out.println("printTable2");
142142
printTable2(6);
143-
143+
144144
System.out.println("printRow3");
145145
printRow3(6, 6);
146-
146+
147147
System.out.println("printTable3");
148148
printTable3(6);
149-
149+
150150
System.out.println("printRow4");
151151
printRow4(6, 6);
152-
152+
153153
System.out.println("printTable4");
154154
printTable4(6);
155155
}

0 commit comments

Comments
 (0)