horseright.gif (6904 bytes) drivehead.gif (2283 bytes) cowleft.gif

Assignment Java-5 (Times)

Purpose: To learn how to convert integers to strings, how to format text, how to use nested loops.

Write a program that (algorithmically) shows a times table.

In other words, I want to type

    java Times

and see

       0  1  2  3  4  5  6  7  8  9
    0  0  0  0  0  0  0  0  0  0  0
    1  0  1  2  3  4  5  6  7  8  9
    2  0  2  4  6  8 10 12 14 16 18
    3  0  3  6  9 12 15 18 21 24 27
    4  0  4  8 12 16 20 24 28 32 36
    5  0  5 10 15 20 25 30 35 40 45
    6  0  6 12 18 24 30 36 42 48 54
    7  0  7 14 21 28 35 42 49 56 63
    8  0  8 16 24 32 40 48 56 64 72
    9  0  9 18 27 36 45 54 63 72 81

To do this, you will need to know how to:

You may also need to

Instructor's solution:

    28 lines

After you have tied up this assignment, lasso the next one:

Assignment Java-6 (Grains)




Page maintained by Marilyn de Queiroz