ITEC102 - Introduction to Programing, Session 1, 2016, Assignment 2
Sydney Institute of Business and Technology (SIBT)
ITEC102 Introduction to Programming
What your program needs to do
Your program should work according to the following specifications.
1) The size of the windows should be 500x500.
2) Background color should be white.
ITEC102 - Introduction to Programing, Session 1, 2016, Assignment 2
3) At start, your program should display a 10x10 grid using thick linesas shown in
Figure 1.
Figure 1: Initial Screen of the Program
4) When you click on the screen above, an input dialogue box should appear on
the screen with the message “Please Enter Letter Code for the Shape” (Figure
2).
Figure 2: The Dialogue Box for the Input of Shape
5) User can enter one of the codes (C, T or L).
6) Your program should read the input character entered by the user in wither case
(upper or lower case).
7) Your program should behave as per following
a. If user entered “C” or “c” in the dialogue box, the program should fill
ITEC102 - Introduction to Programing, Session 1, 2016, Assignment 2
the grid with circles of different colors (Figure 3).
i. Circles should be centered in the boxes of the grid.
ii. The color of circles can be chosen randomly.
b. If user entered “L” or “l”, the program should draw lines of different
colors in each box (Figure 4).
i. Lines should be drawn diagonally from top left corner to the
bottom right corner of the box.
ii. The color of the line can be chosen randomly.
c. If user entered “T” or “t” in the dialogue box, the program should draw
triangles of different colors in the boxes (Figure 6).
i. The top of the triangle should be centered in the box.
ii. The colors of triangles can be chosen randomly.
Figure 3: Circles in the grid
Figure 4: Triangles in the Grid
ITEC102 - Introduction to Programing, Session 1, 2016, Assignment 2
Figure 5: Lines in the Grid
8) When use clicks on any of the shapes inside any box of the grid, that box
should be turned white (Figure 6).
Figure 6: Boxes turning white after click (e.g. 4th box in second row, 5th box in third row and 6th box in fourth row)
9) User can turn any number of boxes to white. Your program should count the
number of boxes turning white.
10)If the user presses any key at this stage, the program should change the screen
to white and should show the results as shown in figure 7.
11)You should write at least 3 functions, drawGrid(), getInput() and drawShapes()
to achieve this output.
ITEC102 - Introduction to Programing, Session 1, 2016, Assignment 2
Figure 7: The results of the shapes drawn and clicked
Submission
Before the due date and time, you must submit your Processing program online via the
ITEC102 iLearn site. You must submit your program as a single Processing source
file called STUDENTLASTNAME.pde (e.g. QURE.pde). No Zip file, text file or a
folder should be uploaded as a submission.
Marking
80% for the correctness of your code. We will check to see that your program
correctly implements the specifications given above.
20% is for the quality of your code. We will check to make sure that you have used
reasonable names and types for your variables and that your code is presented in a
manner that makes it understandable (e.g., good formatting, using comments to
explain what your code is doing). Use the sample programs shown in lectures or the
textbook as guidance.
Note: Zero tolerance in case of plagiarism. Both students, the one who has copied and
the one from whom the code was copied, will be penalised. So it is your responsibility
that you protect your assignment from being copied.
HAPPY PROGRAMMING