Skip to content

Commit b571fea

Browse files
Completed Assignments
1 parent 6995a19 commit b571fea

12 files changed

Lines changed: 567 additions & 0 deletions

‎ch07/.idea/misc.xml‎

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎ch07/.idea/modules.xml‎

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎ch07/.idea/vcs.xml‎

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎ch07/.idea/workspace.xml‎

Lines changed: 381 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎ch07/DoWhile.java‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
public class DoWhile
2+
{
3+
public static void main( String[] args)
4+
{
5+
int num = 100;
6+
7+
do
8+
{
9+
System.out.println("DoWhile Countup: " + num);
10+
num += 10;
11+
}
12+
while (num < 10);
13+
}
14+
}

‎ch07/Exercise7A.java‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
public class Exercise7A
2+
{
3+
public static void main(String[] args)
4+
{
5+
int num = 1;
6+
7+
for (int i = 1; i <= 10; i++)
8+
{
9+
System.out.println("For: " + i);
10+
}
11+
12+
while (num <= 10)
13+
{
14+
System.out.println("While: " + num);
15+
num++;
16+
}
17+
num = 1;
18+
do
19+
{
20+
System.out.println("DoWhile: " + num);
21+
num++;
22+
23+
}while (num <= 10);
24+
25+
for (int i = 10; i >= 1; i--)
26+
{
27+
System.out.println("For CD: " + i);
28+
}
29+
num = 10;
30+
while (num >= 1)
31+
{
32+
System.out.println("While CD: " + num);
33+
num--;
34+
}
35+
num = 10;
36+
do
37+
{
38+
System.out.println("DoWhile CD: " + num);
39+
num--;
40+
41+
}while (num >= 1);
42+
43+
44+
}
45+
}

‎ch07/Exercise7B.java‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
public class Exercise7B
2+
{
3+
public static void main(String[] args)
4+
{
5+
int num = 0;
6+
7+
for( int i = 0; i <= 100 ; i+=10)
8+
{
9+
System.out.println("For: " + i );
10+
}
11+
12+
while ( num <= 100)
13+
{
14+
System.out.println("While: " + num );
15+
num += 10;
16+
}
17+
18+
num = 0;
19+
20+
do
21+
{
22+
System.out.println("DoWhile: " + num);
23+
num += 10;
24+
} while(num <= 100);
25+
}
26+
}

‎ch07/Exercise7C.java‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
public class Exercise7C
2+
{
3+
public static void main(String[] args)
4+
{
5+
int num = 100;
6+
7+
for( int i = 100 ; i >= -100; i-=8)
8+
{
9+
System.out.println("For: " + i);
10+
}
11+
12+
while ( num >= -100)
13+
{
14+
System.out.println("While: " + num);
15+
num -= 8;
16+
}
17+
18+
num =100;
19+
20+
do
21+
{
22+
System.out.println("DoWhile: " + num);
23+
num -= 8;
24+
}while ( num >= -100);
25+
26+
}
27+
}

‎ch07/Exercise7D.java‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
public class Exercise7D
2+
{
3+
public static void main(String[] args)
4+
{
5+
int num = 1;
6+
7+
while ( num <= 20 )
8+
{
9+
System.out.println(num);
10+
num++;
11+
}
12+
}
13+
}

‎ch07/For.java‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
public class For
2+
{
3+
public static void main( String[] args)
4+
{
5+
int num = 0;
6+
7+
for (int i = 1; i < 4; i++)
8+
{
9+
System.out.println("Outer Loop i= " + i);
10+
}
11+
12+
for (int j = 1; j < 4; j++)
13+
{
14+
System.out.println("\tInner Loop j=" +j);
15+
System.out.println("\t\tTotal num=" + (++num));
16+
}
17+
}
18+
}

0 commit comments

Comments
 (0)