Java Reference
In-Depth Information
13.
Modify the code so that it now produces the following output:
99999888887777766666555554444433333222221111100000
99999888887777766666555554444433333222221111100000
99999888887777766666555554444433333222221111100000
99999888887777766666555554444433333222221111100000
99999888887777766666555554444433333222221111100000
14.
Modify the code so that it now produces the following output:
999999999888888887777777666666555554444333221
999999999888888887777777666666555554444333221
999999999888888887777777666666555554444333221
999999999888888887777777666666555554444333221
15.
Write a method called
printDesign
that produces the following output. Use nested
for
loops to capture the
structure of the figure.
-----1-----
----333----
---55555---
--7777777--
-999999999-
16.
Write a Java program that produces the following output. Use nested
for
loops to capture the structure of the figure.
(See also Self-Check Problems 29 and 30.)
!!!!!!!!!!!!!!!!!!!!!!
\\!!!!!!!!!!!!!!!!!!//
\\\\!!!!!!!!!!!!!!////
\\\\\\!!!!!!!!!!//////
\\\\\\\\!!!!!!////////
\\\\\\\\\\!!//////////
17.
Modify your program from the previous exercise so that it uses a global constant for the figure's height. (You may
want to make loop tables first.) The previous output used a constant height of 6. The following are the outputs for
constant heights of 4 and 8:
Height 4
Height 8
!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
\\!!!!!!!!!!//
\\!!!!!!!!!!!!!!!!!!!!!!!!!!//
\\\\!!!!!!////
\\\\!!!!!!!!!!!!!!!!!!!!!!////
\\\\\\!!//////
\\\\\\!!!!!!!!!!!!!!!!!!//////
\\\\\\\\!!!!!!!!!!!!!!////////
\\\\\\\\\\!!!!!!!!!!//////////
\\\\\\\\\\\\!!!!!!////////////
\\\\\\\\\\\\\\!!//////////////
Search WWH ::
Custom Search