You\'ve been hired to write a program! The customer knows in general what he wan
ID: 3651767 • Letter: Y
Question
You've been hired to write a program! The customer knows in general what he wants, but is going to rely on you to handle the technical details. He wants a program that can draw shapes on the screen, as many as he wants, in any order, and any size he wants. The shapes will include Square, Rectangle, Triangle, and optionally (a Challenge) Pyramid, like this:****** ** * *
****** ** ** ***
*** *****
How do you find out what the user wants drawn?
How do you find out how big the drawing should be?
How will arrays be used, if you use them?
How will the switch statement be used, if you use it?
How will functions be used?
How will const be used?
Explanation / Answer
Code for An applet program to draw different shapes in Java import java.awt.*; import java.applet.*; publicclass LineRect extends Applet { publicvoid paint(Graphics g) { g.drawLine(10,10,50,50); g.drawRect(10,60,40,30); g.setColor(Color.blue); g.fillRect(60,10,30,80); g.setColor(Color.green); g.drawRoundRect(10,100,80,50,10,10); g.setColor(Color.yellow); g.fillRoundRect(20,110,60,30,5,5); g.setColor(Color.red); g.drawLine(100,10,230,140); g.drawLine(100,140,230,10); g.drawString("Line Rectangles Demo",65,180); g.drawOval(230,10,200,150); g.setColor(Color.blue); g.fillOval(245,25,100,100); } };
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.