Git-Leon cce3bcfda1 Update README.md 7 years ago
src Second update 7 years ago
.gitignore Updated gitignore 7 years ago
README.md Update README.md 7 years ago
pom.xml Second update 7 years ago

README.md

ZCW-MicroLabs-Loops

1) 1 to 10

In the class Numbers, complete the method called oneToTen() so that it returns a string of the numbers 1 to 10. The Unit Test is provided for you.

Example

1: oneToTen()
2: *** Output ***
3: 0
4: 2
5: 3
6: 4
7: 5
8: 6
9: 7
10: 8
11: 9
12: 10

2) Odd Numbers

In the class Numbers, complete the method called oddNumbers() so that it returns a string of the positive odd numbers less than 20. The Unit Test is not provided for you, you must complete it.

Example

1: oddNumbers()
2: *** Output ***
3: 1
4: 3
5: 5
6: 7
7: 9
8: 11
9: 13
10: 15
11: 17
12: 19

3) Square Numbers

In the class Numbers, complete the method called squares() so that it returns a string of the square numbers up to 100. The Unit Test is not provided for you, you must complete it.

Example

1: squares()
2: *** Output ***
3: 1
4: 4
5: 9
6: 16
7: 25
8: 36
9: 49
10: 64
11: 81
12: 100

~## 4) Random Numbers~ // this problem is under maintainence; attempt at your own discretion. In the class Numbers, complete the method called random4() so that it returns a string of out four random integers between 0 and 9. The Unit Test is not provided for you, you must complete it.

Example

1: random4()
2: *** Output ***
3: 3
4: 5
5: 2
6: 8

5) Even Numbers < n

In the class Numbers, complete the method called even() so that it returns a string of the positive even numbers less than n. The Unit Test is not provided for you, you must complete it.

Example

1: even(20)
2: *** Output ***
3: 2
4: 4
5: 6
6: 8
7: 10
8: 12
9: 14
10: 16
11: 18

6) Powers of 2

In the class Numbers, complete the method called powers() so that it returns a string of out the powers of 2 from 2^1 up to to 2^n. The Unit Test is not provided for you, you must complete it.

Example

1: powers(8)
2: *** Output ***
3: 2
4: 4
5: 8
6: 16
7: 32
8: 64
9: 128
10: 256

7) Are we there yet?

  • Modify method areWeThereYet in the class CarRide.
    • This method should return "Good!" when receiving an argument of "Yes".
  • Create class CarRideTest

    • Create method testAreWeThereYet1

      • The method should ensure the areWeThereYet method returns "Good!" upon passing an arugment of "Yes".
    • Create method testAreWeThereYet2

      • The method should ensure the areWeThereYet method does not return "Good!" when receving an argument that is not "Yes".
  • Create class MainApplication

    • Using the CarRide class, continually prompt the user for input until they response with "Yes".
    • Upon termination, the application should display the value returned from invokation of areWeThereYet.

Sample Console Output

1: Are we there yet?
2: No
3: Are we there yet?
4: Spoons
5: Are we there yet?
6: Yes
7: Good!

8) Triangle

In the class Shapes, complete the method called triangle() so that it uses nested loops to produce the following pattern . The Unit Test is not provided for you, you must complete it.

Example

1: triangle()
2: *** Output ***
3: *
4: **
5: ***
6: ****
7: *****

9) Table Square

In the class Shapes, complete the method called tableSquare() so that it uses nested loops to produce a 4x4 table square. The Unit Test is not provided for you, you must complete it.

Example

tableSquare()
*** Output ***
A 4 x 4 table square

| 1 |  2 |  3 |  4 |
| 2 |  4 |  6 |  8 |
| 3 |  6 |  9 | 12 |
| 4 |  8 | 12 | 16 |

## 10) Table Squares

In the class Shapes, extend your answer to the last question produce a method that will return string of characters out og n x n table square. The Unit Test is not provided for you, you must complete it.

Example

tableSquares(6)
*** Output ***
A 6 x 6 table square

| 1 |  2 |  3 |  4 |  5 |  6 |
| 2 |  4 |  6 |  8 | 10 | 12 |
| 3 |  6 |  9 | 12 | 15 | 18 |
| 4 |  8 | 12 | 16 | 20 | 24 |
| 5 | 10 | 15 | 20 | 25 | 30 |
| 6 | 12 | 18 | 24 | 30 | 36 |