|
Mr. Rogers AP Computer Science A - Third Quarter Objectives |
| Syllabus | 1st Quarter | 2nd Quarter | 3rd Quarter | 4th Quarter |
|
Major Software Project
Chapters 15, 16, 17, Basic GUI Information (scroll down to appendix D)
| Essential Question: How can we create a user-friendly, even-driven program? |
|
||
|
|
|
|
||
|
|
|
Programming assignments (summative/formative assessment):
1. Modify NewGuiGraphicsDemo as follows:
Add one or more bouncing objects.
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.
Add a slider that adjusts bounce speed to the South Control Panel.
Add a menu item that changes the dot size and contains a radio button group with the following options: small, medium, and large.
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.
Examples:
- 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.
- overloading of methods: these are methods in the same class that have the same name but different parameters.
- Example declaration:
- public abstract int tax(); // Note that there is no code, not even brackets.
- Example declaration:
- public abstract class People {
- . . .
- }
- Example declaration:
- public interface Career {
- . . .
- }
Has no abstract methods.
interface -- contains only abstract methods, no instances of the interface are allowed
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
- A class can only extend one class but can implement multiple interfaces.
- Interfaces make code readable and uniform by standardizing the labeling of procedures (methods).
- a superclass's constructors must be used to initialize private fields
- a superclass's constructors can be called inside the subclasses constructor using super (<appropriate arguments>);
- if the superclass's constructor is not called the no-arguments-constructor of the superclass is run by default
- if there is not a no-arguments-constructor, an error message results
Homefun (summative/formative assessment): Exercises 1-5
Programming assignments:
1. Pumpkin Farm Simulation: Create the following:
Squash class -- has a private 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
PumpkinFarm class -- implements Crop, creates a local (in the main method) object array of ten pumpkins 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:
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 int 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.
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.
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).
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..
- Initialize an int variable n to the largest index in the array.
- Find the biggest in the first (n) elements array.
- Swap the biggest for the element n.
- Perform n - -
- Repeat while n >= 1.
- selection sort
- insertion sort
- merge sort
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.
State the 2 major categories of files.
binary
ASCII or Unicode (text)
Describe how the lines in text files are ended ( CR+LF).
Be as one with the following vocabulary: buffer, stream, random-access file.
Be aware that a stream can be opened for input or output but not both at the same time.
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.
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.