Ms Gold's

Computer Science Classes at Marshfield High School

AP Java Programming Assignments for

September 20, 2011

Link to Lesson Plan

AP Java

 

Resources

Java Concepts, Cay Horstmann
Be Prepared for the AP Computer Science Exam in Java, Maria Litvin
AP Java - Maria Litvin
www.eimacs.com
GridWorld - AP Collegeboard

Starting Week 9/22

Finish off all Chapter Problems and Read Chapter 2

Link to Study Guide

    Angle Sine Cosine
    0
    0
    1
    90
    1
    0
    180
    0
    -1
    270
    -1
    0
    360
    1
    1
    • Lesson 3
      • Objective Review Introduction to Java - JVM, Primitives and Casting
      • Write a weekly Journal at H:/APJava/journal/firstInitialLastnameJournalDate.doc
      • Ran a program in Eclipse on the H drive in a directory called H:/APJava/workspace
      • Find the College Board site
      • Find and do one exercise in JavaBat
      • Go through the links on the Web site.

         

Objective - How the Java Run Time Environment Works and memorize the 8 Java Primitives
  • Lecture 4
    • JVM- A program written in Java receives services from the Java Runtime Environment (JRE) software by issuing commands to, and receiving the expected results from, the Java software. By providing these services to the program, the Java software is acting as a "virtual machine", taking the place of the operating system or hardware for which the program would ordinarily be tailored. from the Wikipedia explanation of the Java Virtual Machine - read more of this
      • 8 Primitive data types in java
        byte 0
        short 0
        int 0
        long 0L
        float 0.0f
        double 0.0d
        boolean false
        char '\u000'

         

      • Casting is converting one data type to another. There is two kinds of casting one between primitives numeric types and Objects. Casting between primitives numeric types is used to convert larger values, such as double values, to smaller values such as doubles to integers. For Objects All classes are child classes of java.lang.Object, so you can freely cast any class to Object class, or any class within the same family.
      • Link to Chapter One Power Point Slides
      • Objective - If you know the java primitive and conversion rules you are guaranteed a certain number of correct answers on the AP test
      • On the Computer

    Make sure all work is in H://AP/workspace - I will be copying your workspace onto my flashdrive to grade you. If your work is not in the correct space you will receive a zero for the assignment.

    ArrayList methods and Facts
    • ArrayLists <String> myArrayList = new ArrrayList <String>();
      • No Primitives
        • add(E o) - appends to the end of this list
        • add(int index, E element) - inserts the specified element at the specified position in the list
        • clear() - removes all elements from the list
        • contains(object elem) - Returns true if this list contains a specfied element
        • get(int index) - Returns the element at the specified position in the list
        • indexOf(Object elem) - Searches the first occurence of the given argument, testing for equality using the equals method
        • Iterator <E> iterator() - Returns an iterator over the elements in this list in proper sequence.
        • isEmpty() - Tests if this list has no elements
        • public interface ListIterator extends Iterator -An iterator for lists that allows the progrmmer to traverse the list in either direction, modify the list during iteration, and obtain the iterator;s current position in the list. A ListIteratior has not current element; its cursor position alsways lies between the element that would be returned by a call to previous() and that would be returned by a call to next(). In a list of length n, there are n+1 values, from 0 to n, inclusive.
        • remove(int index) - Removes the element at the specified position in this list.
        • remove(Object o) - Removes a single instance of the specified element from the list, if it is present (optional operation)
        • set(index, E element) - Replaces the number of elements in this list
        • size() - Returns the number of elements in the list.

     

***********************************************************************************************
 

Sorting and Searching

Read and Answer all GridWorld Questions http://www.collegeboard.com/prod_downloads/student/testing/ap/compsci_a/ap07_gridworld_casestudy_3.pdf

 

OO Vocabulary List

  • Chapter 14
    • Sorting - P14.2, P14.4,
    • Searching - P14.8
    • Analyzing the Performance of Sort Algorithms (You are responsible for knowing this
  • emacs on searching and sorting
  • Comparator Interface A Class - 14.13
Read AP Scoring Information
AP Scoring in Detail
What AP scores represent
Each AP Exam score is a weighted combination of the student's score on the multiple-choice section and the free-response section. The final score is reported on a 5-point scale:
5 = extremely well qualified to receive college credit and/or placement
4 = well qualified to receive college credit and/or placement
3 = qualified to receive college credit and/or placement
2 = possibly qualified to receive college credit and/or placement
1 = no recommendation for receiving college credit and/or placement
Periodically, the AP Program conducts college comparability studies for each AP subject by administering a portion of the AP Exam to college students enrolled in equivalent courses. The Program then compares the performance of these students on the sample AP Exam with their actual course scores. Results indicate that:
* AP Exam scores of 5 are equivalent to grades of A in the corresponding college course.
* AP Exam scores of 4 are equivalent to grades of A-, B+, and B in college.
* AP Exam scores of 3 are equivalent to grades of B-, C+, and C in college.
*******************************************************************************************************************************
  • Vocabulary
    • Encapsulation
    • Polymorphism
    • API Documentation
    • accessor and mutator
    • class
    • constructor
    • implicit parameter
    • parameter
    • method
    • new
    • object and object reference
    • overloading
    • primitive type

How to Download GridWorld.

First unzip the GridWorld.zip file into your Eclipse workspace. Don't make a directory the zip will make it for you. This directory will be called GridWorldCode. In Eclipse create a java project called GridWorldCode. Then run firstProject - BugRunner as a Java Application.

Important Links

Java cscie160 -For Distributed Programming

College Board Information

Sun the Really Big Index

Sun OO Tutorials

Sun Java Package Tutorial

How to Write Doc Comments for the Javadoc Tool

GridWorld Quick Reference

 

 

3D Mandelbrot (fractal) images

Marble Madness - Understanding Binary Math

How to make a Marble Machine

Object Oriented Vocabulary List
      • Encapsulation
      • Polymorphism
      • API
      • Documentation
      • accessor and mutator
      • class
      • constructor
      • implicit parameter
      • parameter
      • method
      • new
      • object
      • object reference
      • overloading
      • primitive type

Mathematical Definition of reciprocal is a number that you multiply by so that the result equals 1. The easiest way to find it is to just flip the fraction over.
Here's an example: What is the reciprocal of 3?
3 is the same as 3/1, so we flip and the reciprocal is 1/3

Reciprocal of 4/5 is 5/4
Change to a fraction --> 5/2, then flip --> 2/5

"Transformations are used to convert coordinates in the coordinate system used to describe the world into the coordinate system used by the display screen as seen from the eye point. The world tends to be described in units like feet or millimeters while the screen is measured in pixels." From Doing it Fast - on Game Programming by Bob Pendleton