please include comments //. thenk you. PLEASE DONT FORGET TO DRAW THE BAD GUY AT
ID: 3713515 • Letter: P
Question
please include comments //. thenk you. PLEASE DONT FORGET TO DRAW THE BAD GUY AT THE END TOO, INSTRUCTIONS ARE ON THE BOTTOM. I APPRECIATE YOUR HELP!!!
Objective
To practice drawing with Java graphics.
Overview & Instructions
Build a Java application to draw the following four graphic objects in the application window. Utilize a simple user interface that allows the user to select one or more of the objects to view or hide.
A smiley face
Draw a house and a pine tree.
Create a new color to make the brown tree trunk. Try various RGB patterns to find brown.
Design and draw a personal logo. Use your initials, or some image that depicts you.
Include the use of font control for text sizing.
Finally, if you were tasked with implementing a battle game as an applet, draw an image of a bad guy, an enemy fighter, or some other sinister image. (Just one image)
?
A smiley face
Draw a house and a pine tree.
Create a new color to make the brown tree trunk. Try various RGB patterns to find brown.
Design and draw a personal logo. Use your initials, or some image that depicts you.
Include the use of font control for text sizing.
Finally, if you were tasked with implementing a battle game as an applet, draw an image of a bad guy, an enemy fighter, or some other sinister image. (Just one image)
?
Explanation / Answer
A smiley face Program:-
################################
package guimodule;
import processing.core.PApplet;
public class Mysmiley extends PApplet
{
public void setup()
{
size(400,400);
background(200,200,200);
}
public void draw()
{
fill(255,255,0);
ellipse(200,200,390,390);
fill(0,0,0);
ellipse(120,130,50,70);
ellipse(280,130,50,70);
noFill();
arc(200,280,75,75,0,PI);
}
}
######################################
The house Program:-
import java.awt.*;
import java.applet.*;
public class Main184 extends Applet
{
/*
<applet code="Main184.class" width=400 height=450></applet>
*/
public void paint(Graphics gp)
{ int [] x = {150, 300, 225};
int [] y = {150, 150, 25};
gp.drawRect(150, 150, 150, 200); //House
gp.drawRect(200, 200, 50, 150); // Door
gp.drawOval(200, 75, 50, 50); // Skylight
gp.drawPolygon(x, y, 3); // Roof
}
}
####################################################
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.