JAVA Program Control
Practice Exercises
WARM-UP:
a. java Greet
output: "Hello World"
b. java Count
output: 1 2 3 4 5 6 7 8 9 10
Create a Program given
the following:
Exercise#1
n = 3
output:
1 2 3
1 2 3
1 2 3
n
= 4
output:
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
|
Exercise#4
java SortAsc 1 2 5 4 6 8 3
output:
1 2 3 4 5 6 8 |
Exercise#2
n=3
1 2 3
2 3 4
3 4 5
n=4
1 2 3 4
2 3 4 5
3 4 5 6
4 5 6 7
|
Exercise#5
java Average 5 5 5
output: 5
java Average 2 3 5 10 5
output: 5
|
Exercise#3
n=3
1 2 3
2 4 6
3 6 9
n=4
1 2 3 5
2 4 6 10
3 6 9 15
4 8 12 20
|
Exercise#6
java Remover "-" "123-56-90"
output: 123560
java Remover "/"
"8/1/2001 0:00:00"
output: 812001 0:00:00
|
|