Assignment title: Information


ITEC102 - Introduction to Programing, Session 1, 2016, Assignment 2 Sydney Institute of Business and Technology (SIBT) ITEC102 Introduction to Programming Assignment 2 – Grid of Shapes Due: 11:59 P.M, Friday April 29, 2016 (Week Eight) Weight: 20%

Learning Goals

This assignment contributes to the learning outcomes of COMP115 as follows:  Apply problem solving skills to develop algorithms that solve small to mediumsized computational problems: Introductory experience in developing an algorithm to solve a problem from an informal specification of the problem.  Design and code implementations of their algorithms in an imperative programming language: Practical experience in translating a simple algorithm

into an equivalent Processing program that uses drawing, animation and variables.

 Use standard software engineering practices to document, debug and test their programs: Experience in developing a clear program from a specification, testing the conformance of the program to the specification, and debugging any problems that are detected. Introduction

This assignment asks you to write a program to draw and animate shapes. You should only need to use material from up to week 5. The most relevant module is "Pixels and Variables", "Conditions", "Loops" and "Functions". It is strongly recommended that you divide the assignment up into parts, tackle each part separately and don't move on

until you get each one working. Questions If you have questions about the programming for this assignment, ask on the Assignments Forum on iLearn or consult with your tutor. No extensions will be granted except for serious and unavoidable disruption. Contact Muhammad Atif Qureshi as soon as possible, preferably before the due date, if you have suffered a disruption that affects your ability to submit this assignment. 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