Java

TOPIC 11 – GRAPHICS FUNCTIONS

 

 

LESSON WORK

 

 

QUESTION 1

Create a simple flag.  While Canada’s flag would be awesome, perhaps a flag from France or Italy or any other country will take you a little less time.



QUESTION 2

 

Below you will find code that creates 15 different shapes and the window output of that code.  You must associate each shape number with a letter.

If you prefer, here is a link to a PDF document that you can print.

 

THE CODE

 

public class Question2

{

   public static void main (String[] args)

   {

         NOOPDraw.createWindow(500,400,"Guess which one!");

         //SHAPE 1

         NOOPDraw.drawRectangle(50,50,100,50);

         //SHAPE 2

         NOOPDraw.drawRectangle(200,200,50,100);

         //SHAPE 3

         NOOPDraw.drawClosedShape(200,120,220,150,260,160,290,120,260,90,230,100);

         //SHAPE 4

         NOOPDraw.drawLine(0,0,370,300);

         //SHAPE 5

         NOOPDraw.drawEllipse(50,300,100,50);

         //SHAPE 6

         NOOPDraw.drawClosedShape(25,200,35,250,45,200,35,150);

         //SHAPE 7

         NOOPDraw.drawRectangle(200,0,150,75);

         //SHAPE 8

         NOOPDraw.drawRectangle(400,100,75,75);

         //SHAPE 9

         NOOPDraw.drawTriangle(400,290,360,340,440,340);

         //SHAPE 10

         NOOPDraw.fillRectangle(350,175,25,25);

         //SHAPE 11

         NOOPDraw.drawClosedShape(280,300,280,350,300,350,300,300);

         //SHAPE 12

         NOOPDraw.drawRectangle(150,275,50,50);

         //SHAPE 13

         NOOPDraw.drawClosedShape(50,200,100,200,100,240,150,240,150,180,50,180);

         //SHAPE 14

         NOOPDraw.drawEllipse(300,0,75,75);       

         //SHAPE 15

         NOOPDraw.drawTriangle(360,240,440,240,400,290);

   }

 

THE OUTPUT



QUESTION 3

 

You have two options of for this question.  Choose the one you prefer.  Enjoy!

 

OPTION #1


Create a scene of your choice making use of as many functions as possible. 

 

 

OPTION #2

Find a clipart image online and do the equivalent of tracing it.  You can open the image in Paint or Paint.net.  Inside, the x and y coordinates of the mouse are given at the bottom. So if you move the mouse at the ends of different lines, you can know the coordinates of that point.  Use this information to recreate the image with NOOPDraw.

 

Note that curved segments (not full circles) can be replaced by many short straight segments.

 

Image result for outline of car