AP
Computer Science (A)
COURSE
OUTLINE & CLASS PROCEDURES
Link
to CLASS
NOTES BY DATE
COURSE OVERVIEW: AP Computer science provides an introduction to the world of object oriented programming using Java, the rapidly developing language that provides cross-platform access and widespread application. The major focus is on concepts that will be applicable to any object oriented programming language. Students will also experience working with a multi-file large case study provided by the CollegeBoard.. Beginning in 2008 the study will be the GridWorld Case Study. (See the link below.)
PREREQUISITE: Students who take AP Computer Science must have successfully passed the class in Visual Basic entitled Software Design which includes a study of computer history, hardware, control structures and algorithms. Rarely exceptions to this policy have been made for students who can demonstrate equivalent skills.
ASSUMPTION: During this semester students will work in the Math Computer Lab. In addition to class time at the 6:55 AM hour students may use computers during the day when they are not being used by a regular math classes. (During such times it most likely that the computers by the wall will not be occupied unless the class has 35 students.) Students may also use the library computers. Students will treat all equipment with respect. Students are expected to treat each other with respect as well. Students are encouraged to work together. Mindless copying is prohibited. Vandalism, profanity in programs, tampering with someone else’s programs, misuse of equipment or cheating will result in an automatic “F”on projects and loss of Lab privileges.
TEXTBOOKS (with textbook and author links)
Lewis, John, William Loftus, and Cara Cocking. Java Software Solutions for AP Computer Science. Pearson Education, 2004.
Litvin, Maria, and Gary Litvin. Java Methods A & AB: Object-Oriented Programming and Data Structures, AP Edition. Andover, MA.: Skylight Publishing, 2001.(http://www.skylit.com)
Schram, Leon, Multiple-Choice and Free Response Questions in Preparation for the AP Computer Science ("A" & "AB") Examination., D&S Marketing Systems, Inc.
GRADES:
Points will be given for various activities:
Homework
Projects
Tests
Appropriate use of lab time
Quizzes Lab activities
PROCEDURES
FOR PROJECTS: After the
introductory lessons on programming you will be assigned programs to write on a
regular basis. Class lectures will provide you with "hints" as
how to proceed and information about the language structure and syntax.
Some programs will be exercises to be completed in a day or two. Some may
last for up to a week. You
should finish the assignments as soon as possible.
TESTS: Tests and quizzes will be given and graded in a conventional manner.
Students have 3 days to make up a missed quiz or test.
EXTRA TEST: Students not taking the AP exam will have a cumulative test on the day of the AP exam. Students taking the AP exam will be exempt from this test.
FINAL
EXAM: School policies will be followed concerning the taking of final
exams.
GRADES:
Grades will be determined by dividing points by possible points and
determining a percent grade.
93-100
A
85-92
B
75-84
C
70-74
D
69
and below F
AUDIO VISUALS
In
the course of this semester some math videos may be shown during class time
including:
The
Pirates of Silicon Valley
Bill
Gates, Biography
Computer
History
AP CONTENT and resources
The objectives of the AP computer science committee.
Collegeboard AP Computer Science A
http://www.collegeboard.com/student/testing/ap/sub_compscia.html?compscia
http://apcentral.collegeboard.com/apc/public/courses/teachers_corner/4483.html
GridWorld Case Study (131 pages)
http://apcentral.collegeboard.com/apc/members/courses/teachers_corner/151155.html
Course Description from AP (164 pages)
http://www.collegeboard.com/prod_downloads/ap/students/compsci/52435 APCompSci-Locked.pdf
Summarized content (Check List--Make sure you don't forget these terms.)
Java has only 7 primitive types, everything else in java is an OBJECT.
Primitive Types (7 only) |
int, double, boolean, float,
char short, long
These only should be tested by using = = comparisons. Objects need to be compared using other methods. |
short, long float,
char (not on AP exam)
' ' can be used to assign to a char type |
String |
String.substring, and String.equals. concatenation + |
" " can be used to assign strings |
Arithmetic Operators | +, -, *, /, % | |
increment/decrement operators |
++ and --, +=, -=, *=, / =, %= | |
Relational operators |
= =, !=, <, <=, >, >= | |
Logical operations |
&&, ||, ! |
"short circuit" |
numeric casts |
(int) and (double) |
use of .5 for rounding |
escape sequences |
\\, \", \n |
\t Unicode \uxxxx (not on AP) |
Wrapper Classes |
Integer Double |
Integer.parseInt Double.parseDouble (not on AP) |
Output |
System.out.print System.out.println |
|
Arrays | of primitives and objects
Initialization of named arrays (int[] arr = { 1, 2, 3 } |
one-dimensional arrays and two-dimensional rectangular arrays |
control structures | if, if/else, while, for, return | do/while, switch, plain and labeled break and continue (not on AP) |
Method overloading | signature of a method depends only on the number, types, and order of the parameters | |
Classes | use of new operator | |
Visibility |
In the AP Java subset, all classes are public All instance variables are private Methods, constructors, and constants (static final variables) are either public, or private. |
AP Java subset does not use protected and package (default) visibility |
Comments | /* */, and // | |
final | final keyword is only used for final block scope constants and static final class scope constants.final parameters or instance variables, final methods and final classes are not in the subset. | |
static | In the exam, static methods are always invoked through a class | |
null | ||
this | The use of this is restricted to passing the implicit parameter in its entirety to another method | |
input | AP will not test input methods. We will use JOptionPane methods for user interaction. This will require understanding of the Wrapper classes for converting integers and doubles from Strings. |
Standard Classes and Interfaces With Their Required Methods (Check List)
class java.lang.Object | boolean equals(Object other) String toString() |
interface java.lang.Comparable | "implements
comparable"
int compareTo(Object other) // return value < 0 if this is less than other
|
class java.lang.Integer implements java.lang.Comparable |
Integer(int value) // constructor int intValue() boolean equals(Object other) String toString() int compareTo(Object other) // specified by java.lang.Comparable |
class java.lang.Double implements java.lang.Comparable | Double(double value) // constructor double doubleValue() boolean equals(Object other) String toString() int compareTo(Object other) // specified by java.lang.Comparable |
class java.lang.String implements java.lang.Comparable | int compareTo(Object other) // specified by java.lang.Comparable boolean equals(Object other) int length() String substring(int from, int to) // returns the substring beginning at from // and ending at to-1 String substring(int from) // returns substring(from, length()) int indexOf(String s) // returns the index of the first occurrence of s; // returns -1 if not found |
class java.lang.Math | static int abs(int x) static double abs(double x) static double pow(double base, double exponent) static double sqrt(double x) |
class java.util.Random | int nextInt(n) // returns an integer in the range from 0 to n-1 inclusive double nextDouble() |
class java.util.ArrayList |
int size() boolean add(Object x) Object get(int index) Object set(int index, Object x) // replaces the element at index with x // returns the element formerly at the specified position void add(int index, Object x) // inserts x at position index,sliding elements // at position index and higher to the right // (adds 1 to their indices) and adjusts size Object remove(int index) // removes element from position index, sliding elements // at position index + 1 and higher to the left // (subtracts 1 from their indices) and adjusts size |
Topics to master : All of the above terms must be known and their use understood.
Introduction
and background of Java, Java Applications, HTML, Java Applets, Control Structures, Control Structures,
Methods, Arrays , Object-based Programming , Object-Oriented Programming (OOP) ,
OOP, Strings and Characters, Basic GUI Components
UNITS OF STUDY (These may be modified as needed)
Multiple choice questions from Schram book are assigned for homework when topics have been covered.
Title |
Ideas considered |
Java in Context or More Computer History Lab: "The Hello Program" Getting everything to work. Lab |
The need for portability, information hiding, encryption, privacy, encaspsulation. The
confusion about Java 1 and Java 2 The
swing classes Jbutton vs
Button The
Java virtual machine, bytecodes versus complete compiling. Review
of Computer hardware design, primary and secondary memory, processors,
peripherals (the monitor and printer are really files)
Network use vs single-user systems Open
architecture of computer design and modulation of computer code
(reusable components) Intellectual property rights. Stealing is stealing even if electronic.
Ask for permission when using someone else's materials.
Site sources. Give
credit where credit is due. The Java Runtime environment and the Java development kit |
How to do the "Same Thing" as in VB Control Structures in Java STRINGS and the Input problem Lab: write the "guessing game" too high, too low, etc. Lab: Write Euclids Algorithm for GCF
|
A comparison of loops
and control structures
% for Mod. Math.pow for ^ VB commands and Java commands. Strings as input using the JOptionPane method which is similar to an Input Box in VB. This requires the use of the Integer and Double wrapper classes to parse strings for input. Arrays of primitives |
SOME THINGS ARE "Different" or "WE'RE not in Kansas any more!" Lab: Master arithmetic
|
The need for type casting. You can be betrayed by arithmetic. Java is a "grown-ups language." We have to count from zero and we have to be sure where the arithmetic is sent. Round
off error (storage of variables) Scope
of variables & the garbage collector. Importing
calls to Java library classes AND/OR
Boolean Algebra and DeMorgan's Law Pre and Post Conditions |
Everything is an object (except primitives) A together project using gui objects to re-create an earlier VB program assignment for times table flash cards. Lab: Use the javax.swing classes to recreate a flash card program for multiplication tables. Add personality. |
The use of the dot
member to access methods of a class.
VB was Object Oriented all the time! In Java properties are called instance variables Events are called Methods. Action Listeners show the implementation of one class by another After this project students who want to may use gui components for projects. Their use is not required. |
My Pet #1 Our first homemade class Two files work together: The Pet class and the TestPet class which contains the "main" and tests the functionality of your class. Add your own personality |
How to make a class. Instance variables, constructors, static variables, method oveloading, accessors, mutators, return types, parameter lists |
Strings for real Labs: jumble words, change last name, first name format to first name last name as needed by the secretaries who type up the graduation program. Pig Latin A Jumble guessing game |
Substring
concatination, etc
the .equals() method and its necessity. Arrays of Strings |
A Working Class your choice Make a MyFraction class (use your GCF module for reducing fractions--reusable code!) or a MyComplex class that mimics the function of the calculator |
Solve the problems that arise
from making a useful mathematical class.
More practice with function overloading with multiple constructors, methods, returns |
NewPet Lab: NewPet an abstract class Make several classes that extend NewPet. For example MyDog, MyCat, MyFish
|
Data Abstraction Array Lists Encapsulation The use of super Over riding a method The null pointer "is-a" and "has-a" relationships. Apply functional decomposition Properties of ArrayLists so that the TestPet Class can be used to demonstrate polymorphism |
John Conway's "Game of Life" Lab: The Game of Life |
Two dimensional arrays Concatinate a string to represent the matrix and display on JOptionPane Analyze the problem of the boundary cases. |
Recursion Lab: Fibonacci and Factorial |
A method that calls itself! How powerful. |
Sorting and
Searching
Lab: Sort, search |
A comparison of efficiency Applets that show efficiency: University
of British Columbia |
THE LARGE CASE STUDY A close encounter with the GRIDWORLD |
Identify class structure/methods, etc. |
REVIEW, REVIEW, REVIEW Lab: test anything you don't understand |
Practice AP tests
Multiple Choice and Free Response Questions from past AP tests. |
HELPFUL Links
SUN Download compiler:
http://java.sun.com/j2se/1.4.2/download.html
Older machines can use, less memory intensive version
.http://java.sun.com/products/archive/j2se/1.3.1_02/index.html
Sun Tutorial:
http://java.sun.com/docs/books/tutorial/index.html
Swing components
http://javaalmanac.com/egs/javax.swing/pkg.html
Setting up your computer to run Java (Use the advice from Maria Litin's Website)
http://www.skylit.com/javamethods/faqs/index.html
Pellissippi State
http://pstcc15.pstcc.edu/facstaff/caarnold/
Syllabi:
http://www.pstcc.edu/departments/bct/csit1510.html
http://www.pstcc.edu/departments/bct/csit1520.html
Connecticut State
http://chortle.ccsu.edu/CS151/cs151java.html
Colgate University for AP Computer Science
http://cs.colgate.edu/APCS/
MY SYNTAX "cookbook":
HTML template for applets: Replace "MyClass" with name of class in 3 locations and adjust width and height parameters as needed.
You can e-mail me with any questions at myemail here