Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Chapter Exercise Your task for this chapter is to write a Java program using the

ID: 3853058 • Letter: C

Question

Chapter Exercise Your task for this chapter is to write a Java program using the Java Graphics class to create an example of a computer generated image. This is an opportunity for you to explore computer graphics and exercise some individual creativity. You should submit well-documented code, along with a lab report describing your work. What happened in the You should submit well-documented code, along with a lab report describing your work. What happened in the process of exploration and design for your project? How does your code work? How did you use other features of Java, such as branching routines or loops in your work? Tell us about the thoughts behind your finished work. What influenced your work? Your work can be as simple or as complex as you would like, but be careful about taking on something that will be enormously time consuming. If you decide to work on figurative art, It might help to start with a single idea or concept, such as snowfall in the city, or along the Schuylkill. Figurative art can also be static or dynamic. Imagine how, for example, the Bedroom Window example at the end of this chapter could be subtly dynamic.

Explanation / Answer

import java.awt.*;
class GraphicsProgram extends Canvas{
public GraphicsProgram(){
setSize(200, 200);
setBackground(Color.white);
}
public static void main(String[] argS){
GraphicsProgram GP = new GraphicsProgram();
Frame aFrame = new Frame();
aFrame.setSize(200, 200);
aFrame.add(GP);
aFrame.setVisible(true);
}
public void paint(Graphics g){

g.setColor(Color.blue);
g.drawLine(30, 30, 40, 40);
g.drawRect(20, 100, 50, 50);
g.fillRect(20, 100, 50, 50);
g.fillOval(100, 20, 50, 50);
Image img1 = Toolkit.getDefaultToolkit().getImage("sky.jpg");
g.drawImage(img1, 90, 90, this);
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote