In this assignment, your task is to draw something interesting using ASCII art ,
ID: 3682645 • Letter: I
Question
In this assignment, your task is to
draw something interesting
using ASCII art
, subject to a few
constraints that I list below. Please feel free to use your imagination as much as you like. You can
draw something creative and original. One potentially fun way to do this is to produce stylized
representations of well
-known shapes, like the Statue of Liberty
, space shuttle, or Seattle's Space
Needle.
for more information.
Here are the constraints on your program:
•
Your program must use constants in place of any numeric constants (except for 0 and 1), and in
place of any character constants.
•
Your program must use
at least 3 different loops.
•
Your program must use
at least 2 different nested loops in addition to the 3 loops above.
•
One way to w
rit e a Jav
a prog
ra m to d
raw this figu
re wou
ld be to w
rit e a s
ing
le
System.out.println
statement that prints eac
h li ne of the figu
re.
H
ow
eve
r, th
is sol ution
wou
ld receive no credit
.
A
major
pa
rt of
th is assi
gn
men
t is sho
wing tha
t yo
u
unde
rstan
d iteration/
iloop
s.
•
In li nes that have
repea
ted patt ern s of cha
ract
ers that vary in nu
mber fro m li ne to li
ne,
you are recommended
to
represent the li nes and cha
racter patt ern s using neste d for l
oops
.
It may help to writ e pseudocod
e to unde
rst and the pa
tt erns, as desc
ribed in the textboo
k
and lect
ure .
•
The program
wil l be grade
d bot
h on "ex
terna
l correc
tness
" (w
hether the prog
ra m compil es
and p
roduce
s exac
tly the expec
ted ou
tpu
t) and "
interna
l correc
tness
" (w
hether your
sou
rce
cod
e foll ows the coding
gu
ideli nes).
Explanation / Answer
import java.util.InputMismatchException; import java.util.Scanner; public class Test { static int CHAR = 8; public static void main(String[] args) { for (int i = 0; i < 5; i++) { for (int j = 0; j < 5 - i; j++) { System.out.print(" "); } for (int k = 0; kRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.