Advanced Placement Computing Science A Course Overview: This course is intended for students who will study computer programming at University and wish to prepare for the advanced placement exam for computer science A. The content parallels that of a typical first course in programming with the Java language. In order to be successful, students will be expected to exercise problem solving skills similar to those in a mathematics course. Programming skills will be marked based on efficiency, elegance and correctness. The duration of the course is approximately 20 weeks after all holidays and non-instructional days are removed from the 5 month semester. Grading: Tests................................................................. 35% Quizzes…….....................................................15% Programming.................................................. 40% Textbook exercises...........................................10% *The AP CSA exam will not count towards your mark in the course. This course is intended to prepare you to write the exam. *Plagiarism will not be tolerated in this course. All source code submitted will be screened for plagiarism. Any files flagged for plagiarism will not be accepted for marking. Students will have 1 extra school day (whether we meet that day or not) in order to resubmit their assignment. In this case, class time will not be given to students to work on their code. *Group programming assignments must follow a software engineering model for development. During that process students will decide and submit to me the requirements of the project and which members are responsible for which parts. Marks will be given for each individual as well as a small group mark for the integration of your work. Waterloo CCC: Every year the University of Waterloo hosts the Canadian Computing Contest (CCC). This contest is exciting in that if you qualify locally you will be invited to Waterloo to compete nationally. The winners of the National Competition are invited to represent Canada and compete in the world championships. Previous competitions and solutions can be found at: http://cemc.uwaterloo.ca/ccc/past/previous_contests.shtml The style of questions and the topics that appear are usually taken from this (very large) problem set: http://online-judge.uva.es/problemset/ All are invited and encouraged to participate Textbook: Lewis, Loftus, and Cocking. Java Software Solutions for AP Computer Science A. 2nd ed. Upper Saddle River, N.J.: Prentice Hall, 2007. AP® GridWorld Case Study Course website: In order to keep the course moving along and to allow students to work ahead or from home, a course website will be maintained at the following link: http://fcweb.sd36.bc.ca/~joyce_c. Additional resources will also be posted here. Computing Lab: Our class meets 5 times a week in 5 Falcon Place (FP) where we have the computer lab reserved for us. All software a texts will be stored in here. Students may sign out additional resources as needed. Additional time in the lab (lunch/after school/spare block) can be arranged upon request at a time that is mutually convenient. The Java Development tool we’ll use in this course is NetBeans. It is freely available from Sun Microsystems: http://www.netbeans.org/ Curricular requirements as stated by AP central for syllabus submission: C2)The course includes all of the topics listed in the "Computer Science A" column of the Topic Outline in the AP Computer Science Course Description. C3) The course teaches students to design and implement computer-based solutions to problems in a variety of application areas. C4) The course teaches students to use and implement commonly used algorithms and data structures. C5) The course teaches students to develop and select appropriate algorithms and data structures to solve problems. C6) The course teaches students to code fluently in an object-oriented paradigm using the programming language Java. The course teaches students to use standard Java library classes from the AP Java subset delineated in Appendixes A and B of the AP Computer Science Course Description. (Note: Students who study a language other than Java in AP Computer Science must also be taught to use Java, as specified in the AP Java subset.) C7) The course teaches students to read and understand a large program consisting of several classes and interacting objects, and enables students to read and understand the current AP Computer Science Case Study posted on AP Central. C8) The course teaches students to identify the major hardware and software components of a computer system, their relationship to one another, and the roles of these components within the system. C9) The course teaches students to recognize the ethical and social implications of computer use. Topics Outline [C2] Introduction to Computer Systems (week 1) [C8][C9] Objectives: • Learn about the software and hardware components that under which a computer is organized • Understand the role of operating systems, virtual machines, and compilers • Learn about computer number systems/bases and data representation/limitations • Discuss responsible use of computer systems Overview/Expectations At the end of this unit, students will have a deeper understanding of how the parts of a computer interact with the operating system to create the machines we now use daily. They will also have some additional understanding of the social implications and ethical issues with modern day uses of technology. Assignments and Reading/Reference As an introduction to the course, students will review Chapter 1 from our textbook and complete multiple choice questions 1.1 – 1.8 and short answer 1.1 – 1.6. In addition to students’ notes, they will review the self review questions from Chapter 1. Java Basics (week 2-4) [C3][C6] Objectives: • Use an IDE and compile their first programs • Import statements and Sun Java library classes (reading documentation) • Demonstrate proper style and syntax supported by commenting/indentation • Learn about fundamental data types, arithmetic operators and using constants • Basic Console I/O using BufferedReaders, System.out, print, printf and println • Find and correct errors in sample programs and alter their behavior • Classify types of errors: Compile time, run time and logical errors • Casting objects and fundamental data types • Learn static methods from java.lang.Math • Learn to use the methods available in the String class to solve problems • Using strings to process data and check for input errors • Converting numeric types to strings and strings to numeric types • Numerical limits with Integer.MIN_VALUE and Integer.MAX_VALUE Overview/Expectations Students will become familiar with an IDE and how to create and compile basic projects. Programming exercises will focus on the building blocks of the language and reading and writing to the console, delaying objects until the next week. At the end of this unit, students should understand basic Java syntax and how a program is executed step by step. A focus on fundamental data types and mathematical operators will dominate the first programs. Students will become familiar with common text processing tasks and the Java String class. A particular focus will be spent on how strings are processed as input from users: converting to and from numeric values, tokenizing input etc. Unit Overview http://fcweb.sd36.bc.ca/~joyce_c/Courses/Computer%20Science%20AP/Introduction%20to%20Java/ Topic/Section Output using print/println Indentifiers in Java pg. 26 - 41 Slides Self Review: pg. 48 #16,17 Multiple Choice: pg. 50 #6,7,8 Labs and Assignments Tests and Quizzes Programming Projects: pg. 53 #3,4,5,6 Lab Comments Identifiers Recognizing Errors Correcting Errors Introduction to Objects/Strings Variables, Assignments, and Constants pg. 58 - 74 Slides Self Review: pg. 113 #3,7 Multiple Choice pg. 114 #1,2 Short Answer pg. 116-117 #2,3,4,5 Lab 2.1 - 2.2 Names and Places Student Grades Two meanings of plus Numeric Operations, Casting rules and Enumerated data types Getting input with Scanner pg. 75 - 81 Slides Self Review: pg. 113 #12,13,14,15 Multiple Choice: pg. 114 #3,5,6 Short Answer: pg. 117 #6,7 Programming Projects: pg. 119 #2,3,4,5,6,7 Creating and using Objects pg. 82-88 Slides Multiple Choice: pg. 115 #7,9,10 Short Answer: pg. 118 #8,9 Lab 2.3 - 2.4 Area and Circumference Painting a Room Ideal Weight Quiz Intro to JGraphics Programming Exercises: Slides #1-4 in slides Here is the program we wrote on our tour: Main.java Common Java Objects: Strings, Random, Math, Integer and Double pg. 88-99, 144145 (section 3.4) Shortcut operators Slides Multiple Choice: pg. 115 #8 Short Answer: pg. 118 #10-13 Programming Exercises: There are 9 total included in the slides for which you will have two blocks in class to work on them. Introduction to GridWorld Case Study Unit Test Test Conditional Statements (week 5-6) [C3][C7] Objectives: • Write programs/classes with simple if/if else/else statements • Write programs/classes with nested decision statements • Learn to apply logical operators (and, or, not) to compound decision statements • Model algorithms with pseudocode and translate it to Java • Modeling decision structures with UML and translating it to Java Overview/Expectations Students will become familiar with how to issue commands so that their Java programs will make decision branches. In order to help them in the design process, they will also learn pseudocode and UML designs for conditional statements. It is expected that students will be able to trace programs and determine the output of a program by hand that uses compound and nested conditional statements. Assignments and Reading/Reference http://fcweb.sd36.bc.ca/~joyce_c/Courses/Computer%20Science%20AP/Decisions%20and%20Looping/ Topic/Section The if Statement (pg. 128 - 132) Slides Multiple Choice: pg. 180 #1 Short Answer: pg 184 #3,4 The if/else if/else Statement (pg. 132 - 139) Slides Example1.java Multiple Choice: pg. 181 #3 Short Answer: pg. 184 #2,5 Comparing objects with CompareTo (pg. 143) Slides Labs and Assignments Graphics Programming Arithmetic Programming *both at end of slides See exercises at end of slides, there are 2 graphics and 2 standard java exercises See exercises at end of slides, there are 4 total Short Answer: pg. 185 #6 Compound Decisions, using && || and ! (pg. 139 - 141) Slides There are 2 standard java exercises and the rock, papaer, scissors game at the end of the slides. Multiple Choice: pg. 181 #2,3,9,10 Loops and Iteration (week 7-8) [C3][C4][C5][C6] Objectives: • Learn the syntax of for/while loops in Java • Apply loops to programs • Write pseudocode for looping and design UML diagrams • Recognize when to apply nested loops and how to code them • Testing and debugging loops and conditional statements • Using a debugger to find infinite loops and flaws in logical statements • Tracing a program by hand Tests and Quizzes Overview/Expectations As an extension of conditional statements, loops and iteration will build primarily on the for and while loops with Java. Students will become proficient with the syntax and common programming errors due to flaws in logic and infinite loops. In addition to UML designs, students will also learn to use a debugger and trace a program by hand to find errors in their programs and sample programs with intentional errors. Assignments and Reading/Reference http://fcweb.sd36.bc.ca/~joyce_c/Courses/Computer%20Science%20AP/Decisions%20and%20Looping/ Topic/Section For Loops (pg. 160-165) Slides Multiple Choice pg. 182 #4,6 Short Answer pg. 186 #8,9 While Loops (pg. 146-153) Slides Multiple Choice pg. 182 #7,8 Short Answer pg. 185 #7,10,11 Nested Loops (pg. 153-157) Slides Labs and Assignments Tests and Quizzes 4 Java Programs 1 Graphics program Quiz Convert Previous for Loops to while Loops 4 Java Programs Sierpinski's Triangle 3 Programming Exercises Programming Projects Quiz Written exercises due Test Multiple Choice pg. 182 #5 Unit Test GridWorld part 1 (week 9) Objectives: • Experimenting with the GridWorld GUI • Using and modify classes • Black box testing [C3][C7][C9] Assignments and Reading/Reference See GridWorld case study and associated exercises issued by AP collegeboard Objects (week 10-11) [C6] Objectives: • Learn the difference between constructing new objects and referencing objects • Use methods to access member functions and variables • Create basic classes o Public and private keywords o Behavior (methods) and attributes (member variables) o Terminology: constructor, mutator, accessor, encapsulation, information hiding. o Creating methods and properly commenting them for javadoc • Modeling classes in UML • Understanding how to use static variables and methods Overview/Expectations This unit will be an introduction to objects and the object oriented paradigm of programming. Students will begin by learning to use objects through calls to member functions and accessing member variables. After they have worked with objects, they will then learn the syntax and structure to create their own basic classes by modeling the “behavior” of an object (methods) and the attributes it has (member variables). Assignments and Reading/Reference http://fcweb.sd36.bc.ca/~joyce_c/Courses/Computer%20Science%20AP/Creating%20Classes/ Topic/Section Labs and Assignments Creating Classes (pg. 196 - 234) Slides Objects and Reference revisited Important!!! Slides Class Template Files: BankAccount.java Book.java Date.java Slides to go along with textbook readings Slides 4 Java Exercises 2 Graphics Exercises Multiple Choice from text Ch4 Tests and Quizzes Enhancing Classes (p260-278) Slides Source code files from notes: Slogan.java Throwing.java Zero.java Num.java ParameterPassing.java ParameterTester.java Interfaces (pg. 279-285) Slides Source code files from notes: Complexity.java Question.java MiniQuiz.java Block 1) Multiple Choice #1,2,3,10 Short Answer #1,2,3,7 Chapter 5 Lab Exercises Tracing References Changing People Block 2) Banker Class Multiple Choice #6,7,8,9 Short answer #4,6 Prism Interface Classes RectangularPrism TriangularPrism Cylinder Quiz PrismCalculator.java End of Unit Unit Test Arrays and ArrayLists (week 12-14) [C3][C4][C5][C6] Objectives: • Declaring, constructing, initializing and indexing • Storing primitives and objects • Traversing, inserting and deleting elements • Create parallel arrays • Passing Arrays/ArrayLists to methods • Casting, ClassCastException, ArrayIndexOutOfBoundsException • Understand when an Array or ArrayList is most appropriate • Sequential and binary searching • Quadratic sorts: Insertion sort, Selection sort, Bubble sort • Learn mergesort and how its runtime complexity compares to other sorting algorithms • Introduction to complexity and Big-Oh notation • 2D arrays. • Intro the List Interface Overview/Expectations Students will understand the advantages of storing elements in contiguous memory blocks and how to access, modify and traverse these data structures. This section is intended to prepare them for the searching and sorting topics to follow. It is expected that students will be able to implement and demonstrate how the listed quadratic sorting algorithms work. Students will be expected to show how each algorithm changes the state of an array by tracing algorithms by hand. They are also expected to develop some understanding of how complexity affects run time and memory usage of software. Assignments and Reading/Reference http://fcweb.sd36.bc.ca/~joyce_c/Courses/Computer%20Science%20AP/Arrays/ Topic/Section Labs and Assignments Tests and Quizzes Introduction to Arrays (pg. 318 - 337) Slides ReverseOrder.java BasicArray.java Tunes.java CD.java CDCollection.java GradeRange.java LetterCount.java NameTag.java Primes.java Array Operations (pg. 353 - 354) Slides ArrayLists Slides Searching and Sorting Slides ComparisonCounter.java Animations of our sorting algorithms can be found here Multiple Choice pg. 378 #1-3 Short Answer pg. 381 #1,3,5 2 Programming Exercises Histogram Class 2 Programming Exercises DynamicArray class 2 Programming Exercises Card and Deck Class BlackJack Demo Implement each algorithm described in the slides Quiz Advanced Features Slides Two Dimensional Arrays List Interface Inserting and Removing Card Game Insert/Remove methods Unit Test Test Inheritance and Polymorphism (week 15-17) [C3][C4][C5][C6][C7] Objectives: • Implement Interfaces (Comparable, Locatable) • Data structure design and selection • Understand the how Polymorphism works and when to override super class methods • Create and extend abstract classes • Elegance: Data structure/algorithm selection and design • Become familiar with the remaining Actors in the GridWorld case study • Extend the class in GridWorld to make new Actors Overview/Expectations Students will learn how inheritance, polymorphism and interfaces can enhance their class designs. Assignments and Reading/Reference See GridWorld case study and associated exercises issued by AP collegeboard http://fcweb.sd36.bc.ca/~joyce_c/Courses/Computer%20Science%20AP/Inheritance/ Topic/Section Intro to Inheritance pg. 392-419 Slides Labs and Assignments Create your first hierarchy in class during notes Multiple Choice p.453 #1-5 Gridworld part 2 See Gridworld links on left margin Gridworld part 3 See Gridworld links on left margin Do you know set 2 Exercises #1-4 Do you know set 3,4,5&6 JumperBug by yourself Tests and Quizzes Gridworld part 4 Do you know set 7,8,&9 Exercises #1-6 See Gridworld links on left margin Pair project Creating new bugs Polymorphism pg. 420-434 Slides Operator Class Heirarchy Unit Test Test GridWorld is a class library that is used in AP computer science. The classes and their methods are included in the exams for the course and Advanced Placement. The JavaDoc can be found here: http://www.horstmann.com/gridworld/javadoc/ You can download the library for the GridWorld Classes here. The official readings/exercises for unit one from the College Board are located in the file below: Unit 1 You will also need the source file BugRunner.java to complete the exercises Exercises: Print this worksheet to record your answers from the question sets in unit 1 After you've completed the worksheet above, complete these additional exercises Programming: Create a program that displays your initials in a pleasing format using a combination of Actors, Bugs, Flowers, and Rocks. You will need to use the Location class to place Actors in a specific cell. See the javadoc for more info... The official readings/exercises for unit two from the College Board are located in the file below: Unit 2 Source Files: BoxBug.gif BoxBug.java BoxBugRunner.java The official readings/exercises for unit three from the College Board are located in the file below: Unit 3 The official readings/exercises for unit four from the College Board are located in the file below: Unit 4 Source Code: ChameleonCritter.gif ChameleonCritter.java ChameleonRunner.java CrabCritter.gif CrabCritter.java CrabRunner.java CritterRunner.java Recursion (week 18) [C3][C4][C5][C6] Objectives: • Students will explore problems that are naturally suited to recursion • Students will recognize when recursion is appropriate to use as a problem solving tool • Students will identify the base step and recursive step in solving a recursive problem. Overview/Expectations Students are intended to develop some understanding of recursive thinking and how a problem can be broken down into sub problems that can greatly simplify the description (and implementation) of an algorithm. Emphasis will be placed on identifying the base and recursive steps in an algorithm and being able to see the recursion in a loop. Assignments and Reading/Reference http://fcweb.sd36.bc.ca/~joyce_c/Courses/Computer%20Science%20AP/Recursion/ Topic/Section Recursion pg. 466-488 Slides Labs and Assignments Tests and Quizzes Written Work pg. 501 Multiple Choice #1-8,10 pg. 504 Short Answer #7 (do by hand, not with netBeans) Recursion Quiz Fibonacci Loop/Recursion Recursive Triangle Recursion Exercises GCF Unit Test Test Review (weeks 19-20) Objectives: • Students will review materials from the AP CS A course • Write practice finals from sample questions on AP website and provided by the instructor. This page will help you keep organize and give you materials for the final exam. The official AP exam page with previous written questions and solutions can be found here: http://apcentral.collegeboard.com/apc/members/exam/exam_questions/2000.html *Note: Prior to 2008, the Marine Biology case study was used instead of GridWorld. You can ignore the Marine Biology questions, all other questions are still relevant to your studying. From 2008 on, the Gridworld questions appear. The exam also comes with an appendix for you to refer to while writing. You may be wondering just what language features (after all of this) that you are responsible for in the AP Computer Science exam. The subset can be found here. In order to cut down your search, I have compiled many of the web resources here. College Board Sample Exam Questions 2008 Key College Board Sample Exam Questions 2009 (key attached) *Some of the 2008 questions reappear in the 2009 sample I have several practice exams which we will work on during class time also.