Mr. Rogers AP Computer Science A - Third Quarter Objectives

Syllabus
Syllabus 1st Quarter 2nd Quarter 3rd Quarter 4th  Quarter

Latin/Greek Root Words

arch--------->ancient, example: archtype;         chrono------>time, example: chronology;             -dom----------->quantity/state, example: freedom               fer-------->carry, example: transfer;               gen--------->birth, example: generate;                 luc-------->light, example lucid;                 neo--------->new, example: neonatologist;                olig--------->few, example: oligarchy;              omni--------->all, omniscient;            sym--------->together, symbol;

(Comp Sci connection)

 

 Major Software Project

Chapters 15, 16, 17, Basic GUI Information (scroll down to appendix D)

Essential Question: How can we create a user-friendly, event-driven program?

 

  1. Design and create a major software project with a GUI. (See major software project specifications here.)

  2. Correctly use grid layouts.

 
  1. Correctly use boarder layouts.

  1. Be aware that with java graphics the origin is in the upper left corner of the screen and that each pixel's location is given by a pair of integers representing x and y coordinates.

  2. Successfully create action listeners.

 

  1. Create a graphical user interface with a menu bar and pull down menus.

 

Programming assignments (summative/formative assessment):

1. Modify NewGuiGraphicsDemo as follows:

  1. Add one or more bouncing objects.

  2. Modify the program so that the background changes color when the start button is activated and the color changes back when the reset button is activated.

  3. Add a slider that adjusts bounce speed to the South Control Panel.

  4. Add a menu item that changes the dot size and contains a radio button group with the following options: small, medium, and large.

  5. Make a unique event driven modification of your choice.

 

2.

Essential Question: How does OOP  development using Java compare with the process of writing a book using English?

Chapter 11: Class Hierarchies and Interfaces

Relevance: Class Hierarchies and Interfaces make it easier to organize and manage the creation and maintenance of large software projects similar to the way the table of contents, chapters, and appendices help organize books.

  1. Name 2 reasons why duplicate code is a bad idea. (wasteful, hard to maintain)

  2. Explain the purpose of having a hierarchy of classes (inheritance) and how it helps facilitate functional decomposition ( breaking down an overwhelmingly complex task into smaller doable tasks).

  3. Define polymorphism and explain why it is useful (page 293).Polymorphism is the situation in which an inherited method can have more than one meaning.

Example:

overriding of methods: the code within a method inherited from a super class can be altered by recreating the method in the subclass. However, this only alters the code when the method is called by an instance of the subclass. When the method is called by an instance of the super class, the original unaltered code is run.

NOT generally considered polymorphism--overloading of methods: these are methods in the same class that have the same name but different parameters.

  1. Create and use abstract methods (methods that are declared but not defined).
    Example declaration:
    public abstract int tax();  // Note that there is no code, not even brackets.
  2. Create abstract classes (classes with one or more abstract methods).
Example declaration:
public abstract class People {
     . . .
}
  1. Correctly declare an interface.
Example declaration:
public interface Career {
     . . .
}
  1. Define the term concrete class.

Has no abstract methods.

  1. Be aware that all classes automatically extend the class Object.

  2. State the difference between an:

interface -- contains only abstract methods, no instances of the interface are allowed and it has no constructor. Fields in an interface can only be symbolic constants.

abstract class -- contains one or more abstract methods. no instances of the abstract class are allowed

concrete class -- contains no abstract methods. Instances of the concrete class are allowed

  1. Be aware that Java does not allow the creation of objects (instances) of an abstract class or an interface.

  2. Describe the reasons for using an interface.
  1. Be aware that if a class implements an interface (and it can implement as many as it wants), it must supply all the methods specified in the interface.

  2. Invoke a superclass's constructors (p.298).

    To initialize fields inside a super class:

 

  1. Write programs that extend a given class using inheritance.
  2. Write programs that implement interfaces.
  3. Explain how polymorphism applies to interfaces.

 

Homefun (summative/formative assessment): Exercises 1-5

Programming assignments:

1. Pumpkin Farm Simulation: Create the following:

Squash class -- has a protected weight field and a grow method that adds a random double between zero and 10 to weight each time it's run (representing one week's growth).

Pumpkin class -- inherits the Squash class

Crop interface -- contains 1 abstract method called yield ( ) that returns a double representing the yeild from a crop.

PumpkinFarm class -- implements Crop, creates a field with an array of ten pumpkin objects (starting weight = 0) and grows them for 10 weeks. Outputs the total weight of pumpkins using the yield method.

2. Modify NewGuiGraphicsDemo to act as a diffusion simulation as follows:

  1. Add a Dot class that defines the characteristics of a dot. Include public fields for the x and y coordinates, x and y velocities, and the color of the dot (called dotColor).This class should have 2 constructers. The first will have no parameters or code in it (it's required for subclasses). The second will have an Color parameter that sets a value for dotColor and an int parameter that sets a value for x-coordinate. All other initial values of fields will be set using appropriately sized random number generators. Remember, the x-coordinate will locate the dot on the correct side of the screen.

  2. Add a RedDot and a BlueDot class. Have both extend the Dot Class. Both classes will set the respective color of the dot (red or blue) and set the correct screen side by calling the super class constructor in their constructor. To see how this is done, see the InheritanceInterfaceDemo code.

  3. Create an ArrayList of red dots that start on the left side and an ArrayList of blue dots that start on the right side. The 2 ArrayLists will be created in the GraphicsDisplay class (see the example code at right).

  4. Create a vertical barrier in the middle of the screen. The barrier is to have a hole in it so that dots can bounce through the hole but not through the barrier. This code will also reside in the GraphicsDisplay class

 

Summative Assessment: Test Chap 11 Objectives 1-15

 


 

Essential Question: How can we search and sort millions of volatile pieces of similar information without having to create millions of lines of code?

Chapter 13: Searching Sorting and Other Array Elements

Relevance: Searching and sorting are the two of the most common types of algorithms for manipulating data records..

  1. Sequential and binary searches: Write the code. See Diagram of a Binary Search Algorithm

Assignment: Read Dragons and Binary Search

  1. Given a set of data records be able to pick the above search method which will be likely to run the fastest.

  2. Write the code which can find the largest or smallest element in an array.

  3. Correctly use loops for the following:
    • traversals
    • insertions
    • deletions
  1. Selection sort:  Write the code .
  1. Initialize an int variable n to the largest index in the array.
  2. Find the biggest in the first (n) elements array.
  3. Swap the biggest for the element n.
  4. Perform n - -
  5. Repeat while n >= 1.
  1. Be as one with the descriptions of the three sort methods mentioned on page 342

Hypothetical Time Required for Sorting Objects vs Big-O Notation

Items to sort

2 10 100
O(n) 1 5 50
O(n2) 1 25 2500
O(nlogn) 1 17 332
  1. Given a set of data records be able to pick the above sort method which will be likely to run the fastest.

  2. Name the search and sort algorithms which could be categorized as divide and conquer techniques. binary search, merge sort

  3. Be aware of the methods associated with the Array class.

  4. Be as one with chapter 3 of Gridworld.

Homefun: Exercises 1- 6,
Programming assignments: Lab 13.4 Keeping Things in Order, Lab 13.9 Benchmarks, Exercise 12.
13.1 Array Search
  1. Create a program with an integer array containing 20 random numbers. Use code to initialized the array with random integers from 0 to 100.  Using command line input search the array for a specific number. Output the entire array, the highest value, the lowest value, and the index number where the number you searched for was found or a statement that the number was not found.

  2. Add a selection sort (write the code, see p. 332) to the above and output the sorted array by creating a Sort class with selection sort method in it.

  3. Add the code for a binary search which will then search for the element specified earlier in command line input and output the index where it exists. If the value is not found it will output "Not found". Configure the program to find multiple instances of the the search target.

Test: Chap 13 Objectives 1-6


 

Essential Question: How does Java allow a program to read and write to the hard drive?

Chapter 14: Streams and Files

Note: Chapters 14 covers items not typically not found on the AP exam but will be useful in creating your personal project.

  1. State the 2 major categories of files.

  1. Describe how the lines in text files are ended ( CR+LF).

  2. Be as one with the following vocabulary: buffer, stream, random-access file.

  3. Be aware that a stream can be opened for input or output but not both at the same time.

  4. Be aware that a random access file can start reading or writing at any point in the file. It can be opened for both reading and writing at the same.

  5. Be aware that text files tend to have different lengths and are usually treated as streams while binary files of fixed length are treated as random-access files.

 

Note: Chapters 15, 16, and 17 deal with graphics, GUI components, mouse, keyboard, sounds and images. These items are typically not found on the AP exam but will be useful in creating your personal project.

Assignment: Continue working on your  personal project.

GridWorld Part 3: GridWorld Classes and Interfaces
In Class Group Activity: We will do the group activity at the end of Chapter 4 in class
HomefunRead Chapter 3 , Do you know? Set 6

 

Mr

CodingBat--A great site for learning and practicing Java coding. It's basically a work at your own pace Java course.

SAM Team--Southside High School's STEM and Computer Science extra-curricular club (Mr. Rogers Sponsor)

AndSAM Project--A collaboration between Clemson University and Southside High School for bringing Android Phone power to the K-12 classroom.

Mr. Rogers' IB Computer Science -- Android SmartPhone Programming Project

Mr. Rogers T-shirts

Mr. Rogers Information for Teachers

Mr. Rogers Science Fair Information

Check out other web sites created by Mr. R:

 
Insultingly Stupid Movie Physics is one of the most humorous, entertaining, and readable physics books available, yet is filled with all kinds of useful content and clear explanations for high school, 1st semester college physics students, and film buffs.

It explains all 3 of Newton's laws, the 1st and 2nd laws of thermodynamics, momentum, energy, gravity, circular motion and a host of other topics all through the lens of Hollywood movies using Star Trek and numerous other films.

If you want to learn how to think physics and have a lot of fun in the process, this is the book for you!

 

First the web site,

now the book!


Mr. Rogers Home | Common Sylabus | AP Comp Sci I | AP Comp Sci II | AP Physics Mech | AP Physics E&M | AP Statistics | IB Design Tech | Southside

[ Intuitor Home | Physics | Movie Physics | Chess | Forchess | Hex | Intuitor Store |

Copyright 1996-2012 T. K. Rogers, all rights reserved. Forchess is a registered trademark of T. K. Rogers.
No part of this website may be reproduced in any form, electronic or otherwise, without express written approval.