Strand: Computer Science and Programming Unit title: Planning and Programming using Visual C#.Net Year 2013 Version 3 Introduction This unit plan is designed for a Year 12 class, and aims to cover efficiently planning and constructing a basic computer program for a specified task. The software used is Visual C#.Net (2010 Express version freely available from Microsoft). Digital Technologies NZ Curriculum Technological Context Knowledge and Skills – Objectives o o Demonstrate ability to design the structure of an advanced software program Demonstrate ability to construct an advanced software program Curriculum Level 7 Students can: Students can: o specify well-chosen scopes for variables, their scopes and data types. o specify an indexed data structure. o specify a modular structure for the program with well-chosen parameters, including details of the procedural structures of the modules, that constitute a well-structured logical decomposition of the task. o specify a comprehensive set of expected, boundary and exceptional input cases for testing the program. o specify variables, constants, and derived values effectively so as to maximise the flexibility and robustness of an independently constructed plan. o independently implement a plan for an advanced program in a suitable programming language (preferably a text- based programming language). o construct an advanced program where the modules (including their procedural structures) constitute a well-structured logical decomposition of the task. o use variables, constants, and derived values effectively so as to increase the flexibility and robustness of the program. o set out the program code clearly and concisely and document the program with comments that explain and justify decisions. o comprehensively test and debug the program in an organised and time effective way to ensure the program is correct on expected, boundary Key Competencies Thinking skills – actively seek, use and create Using language, symbols and text – representing and Managing self – setting goals, manage projects, knowledge communicating information and ideas using a high level language (e.g. Visual CSharp.Net) working independently Relating to others – students interact with others in Participating and contributing – students participate the classroom (teacher and students) making informed decisions using feedback from teacher and/or peers fully in each lesson, sharing knowledge and creating learning opportunities for others and invalid inputs. Assessment opportunities Internally Assessed: AS91372 digital Technologies 2.45 Construct a plan for an advanced computer program for a specified task page 1 AS91373 digital Technologies 2.46 Construct an advanced computer program for a specified task Student prior knowledge None Resources required A computer with overhead projector and sound for teaching use. Internet access to website http://www.homeandlearn.co.uk/ or the pdf from homeandlearn which has more content. Visual C#.Net programming Computers with programming language installed e.g. Visual C#2010 Express. Resources supplied This document, Programming tutorials and notes: Programming a dodge type game (student workbook), Assessment and assessment schedule Introduction to C# programming Console application Saving work Program Class main Method Using the intellisense menu running programs (debugging) using toolbox to add controls to a form properties code messageboxes http://www.homeandlearn.co.uk/ Visual C#.Net programming C#.Net Getting Started Start with demonstrating console application (Don’t do the cmd line section as our students are locked out of this) Students save work to My Documents\Visual Studio 2010\Projects and back this up to their Home drive later. First line of code How to Run a C# program First C# windows form Adding controls to a form properties of a control adding code to a button C# message boxes More about C# message boxes Variables strings, concatenation; comments; numbers variables: integer, Float and Double; addition, subtraction, operators, getting numbers from text boxes. Students work through: C#.Net variables section Conditional Logic if; if .. else; else ..if; switch, conditional operators Students work through: C#.Net variables section Loops for, list boxes, Do loops, C# loops from string variables to 18 the equals button This section includes developing a simple calculator) Do Exercises A, B C and the other non lettered exercises Exercise D, E, F Exercise G, H Add Menus Using menus C# add Menus to your forms do 1. Add Menus … 3. menu shortcuts debugging Design-time errors, Run-Time errors, Logical errors, breakpoints, the locals window C# Debugging Design-time errors, Run-Time errors, Logical errors, breakpoints, the locals window Exercise I C# Methods C# Methods understanding methods, passing values, returning values. page 2 C# Arrays Arrays Understanding arrays. Plus resource: Arrays in CSharp (looks at the random class as well) String Manipulation Do sections 1, 8, 9 Events Do sections 1 - 5 Classes and objects (students get general idea from website. Then reinforce the concepts of OOP with the resource, in particular encapsulation) Graphics in C# Do up to 7. Class Constructors Validating input from users use resource … 201_COS_Some input validation techniques.docx Designing a Visual C#.Net program (or any program) The steps we will look at are: 1. Investigate and understand the problem 2. Plan/Design the algorithm (we will use pseudocode) 3. Implement the solution. 4. Debugging and testing the solution. Demonstrate the steps Then use resource Object Oriented Programming.docx use resource How to create graphics for drawing.docx First on a simple problem. (Use resource Level2_Catch the Alien.docx) Then on a Dodge type game. (use resource … Level Two_CSharp Dodge.docx) This is the Programming Process. It is iterative, we keep coming back to the steps. It could be 3 and 4 repeated or we might need to revise our plan then implement and test again. Assessment page 3