Mr. Rogers AP Computer Science A - Second Quarter Objectives

 

Essential Question: Do we live in a binary world?

Chapter 7: Boolean Expressions and Conditional Control

  1. Define conditional control.

  2. Correctly use both if and if-else statements. (Be as one with the four Common if-else Errors on p. 156.)

  3. Draw flowcharts for both if and if-else statements.

  4. Correctly use boolean relational  operators. == ,  > ,  < ,  >= ,  <= ,  !=

  5. Correctly use boolean logical operators. && ,  || , !

  6. Given a set of  logic gates write the associated boolean expression (p. 3).

  7. Write truth tables for "and", "or", and "xor" gates.

  8. Evaluate complex boolean statements using correct order of operators (p. 163).

  9. Correctly describe and use short-circuit evaluation.

  10. Correctly use if-else-if tables for menus and selection processes like tax tables.

  11. Correctly use switch statements. (Be as one with the six points on p. 197)

Homefun:  Exercises 1-7 
Programming Assignments: Lab 7.10, Lab 7.12; exercises 14, 17
Tax Code Program II: rewrite the tax program entirely with if-else-if tables

Test: Chap 1 & 2 Objectives 1-29


 

Essential Question: How can we access and perform similar manipulations on millions of volatile pieces of similar information without having to create millions of lines of code?

Chapter 8 Iterative Statements (Loops)

  1. State the 3 elements which must be present for any loop (p. 299).
  • initialization
  • testing
  • incrementing
  1. Correctly use "while" loops.
  2. Correctly use "for" loops.
  3. Correctly use "do-while" loops.
  4. State which loop always runs at least once.
  5. State the most appropriate loop(s) to use when the number of iterations are known and when they are not known.
  6. Appropriately use break and return statements for ending loops.
  7. Correctly use loops for manipulating values in arrays.
  8. Correctly use nested loops.
  9. State the number of times each loop runs when using loops or nested loops.
  10. Be aware that a break statement in an inner loop will only break out of the inner loop.
  11. Use loops for the following programs:
    • even/odd numbers
    • factorials
    • fibonacci numbers
 
Homefun: Exercises 8, 9, 13
Programming Assignment: Lab 8.6; Exercise 10, 11, 12

Test: Chap 8 Objectives 1-12


 

Essential Question: Why use objects instead of just using variables?

Chapter 9: Implementing Classes and Using Objects

  1. Properly declare a class.

  2. Explain why fields are usually declared private and methods public.

  3. Correctly declare and initialize (generally with the new operator) objects

  4. Be as one with the nature of methods.

  1. Correctly write the header which declares a method inside a class.

access (public or private) returnType methodName (type parameterName1, ... type parameterNameN)

  1. Explain the terms precondition and post condition as they relate to methods and procedural abstraction.

  2. Explain how assertions and runtime exceptions are used in debugging, especially for reusable code.

  3. Correctly use comments with method declarations so that a programmer could use the method without knowing the details about how the code is implemented.

  4. Explain the nature of parameters.

  1. Explain the difference between an argument and a parameter.

  2. Correctly use overloaded methods. (Same name different arguments)

  1. Correctly use constructers.

  1. Correctly use copy constructors.

  2. State when the default constructer runs and how it initializes fields.

  1. Correctly use the "final" reserved word.

  2. Correctly initialize objects and use the new operator (p. 224).

Homefun: read Sections 9.1 - 9.5; Exercises 1-6

  1. State which type of fields can be accessed and what type methods can be called using a static method. (p. 223).

  1. State which type of fields can be accessed and what type methods can be called using an instance method (p. 223).

  1. Correctly call both static and instance methods (p. 226).

  1. Compare the two ways to pass arguments to methods and constructers (p. 230).

  1. Correctly use return statements.

Homefun: Read Sections 8.6 - 8.10; Exercises 8, 9, 13
Programming Assignment: Lab 8.6; Exercise 10, 11, 12

Test: Chap 9 Objectives 1-20


 

 

Essential Question: How can we store and manipulate not just numbers but human text in a computer program?

Chap. 10 Strings

  1. Recognize literal strings.
  2. Be familiar with the 2 most common of String's 9 constructors.
  1. Be aware that Strings are immutable objects.
  2. Understand how Strings are initialized.
  1. Be aware that calling a String method with a String set to null will give run-time errors. (An empty string initialized to " " is not the same thing as a string initialized to null.)
  2. Correctly use common String methods (See table on p. 265.)
  1. Correctly use the various ways of doing concatenation (adding Strings). (p. 266)
  1. Correctly use relational operators with Strings. p. 268)
  2. CANNOT use == , != , < , >, <= , >=
  3. CAN use equals(s2), equalsIgnoreCase(s2), compareTo(s2) methods, compareToIgnoreCase (s2)
  4. Correctly convert numbers into Strings and Strings into numbers.

examples

Integer.parseInt(yourString)

String.valueOf(yourNumber)

  1. Explain the term wrapper class.
  2. Correctly use the Character wrapper class methods. (p.275)
  3. Correctly use the StringBuffer class (p. 278).

Homefun: Exercises 1-6;
Programming assignments: Lab 10.8

Test: Chap 10 Objectives 1-13


 

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

Chapter 11: Class Hierarchies and Interfaces

  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 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).
  4. 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.
  5. 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, abstract class, and concrete class.
  3. Be aware that Java does not allow the creation of objects (instances) of an abstract class or an interface.
  4. 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).
  1. Write programs that extend a given class using inheritance.
  2. Write programs that implement interfaces.
  3. Explain how polymorphism applies to interfaces.

 

Homefun: Exercises 1-5

Programming assignments: 6a

Test: Chap 11 Objectives 1-15


 

Essential Question: How can we store millions of volatile pieces of similar information without having to create millions of variables in a computer program?

Chap. 12 Arrays and ArrayLists

  1. Correctly declare and initialize arrays.
  1. State the default values when initializing arrays
  1. Know that once declared and initialized, the size of an array cannot be changed.
  2. Know that the elements of arrays are numbered starting with 0. These elements can be randomly accessed using the indices or subscripts.
  3. Correctly use the array length field.
  4. Be aware that arrays are always passed to methods by reference.
  5. Correctly declare and initialize 2D arrays.
final int ROWS = 2;
final int COLS = 3;
double name2DArray [ ] [ ] = new double [ROWS][COLS];
    or
double name2DArray [ ] [ ] =
{
        {0.0, 2.7, 5.6},
        {4.3, 1.4, 7.2}
};
  1. Be aware that the first dimension in a two dimension array is considered the number of rows while the second dimension is the number of columns.
  2. Correctly use the length field to  find the number of rows and columns.
  1. Be aware that arrays with more than 2 dimensions can be declared.
  2. Correctly use parallel arrays.
  3. State the advantage of using ArrayList. Can expand and contract as needed
  4. Be familiar with ArrayList's constructors and methods (see page 331).
  5. Be aware of the pitfalls of using ArrayLists.
  6. Describe how classes and arrays are key elements used to form data structures.
  7. Describe why abstraction is an important theme in data structures.
  8. Be as one with Chapter 2 of GridWorld.
 
Homefun: Exercises 1-5;
Programming assignments: Lab 12.9, 12.11
 
12.1 Simple Data Base Program
Create a program with a class called Employees. In the main method create 3 parallel ArrayLists: 2 holding 6 first names and 6 last names plus a third ArrayList with the corresponding Salary for each employee. Use an output method concatenate the first and last names, and output the data in two columns as shown in the example:
 
Name                 Salary $1000/yr
Bob Arnold            90
Herb Bobo            12
Jane Cool             27
Alfred Nameless   49
Juan  Smith          200
Betty Taylor         142

Next, output the total of all salaries. Use a random number generator to fire two employees. Remove them from the Array List then add a new employee called Bob Newguy with a salary of $200,000. Again, output a table with the names of the current employees and their salaries. Also output the total of all salaries.

 

 

12.2 2-D Array Output
Create a program with a class called Alphabet with 3 local (inside main method) of 2-dimentional arrays: each will contain a large-sized letter respectively A, B, and C. Use a separate method to output the letters alphabetically in a column with A at the top.

Note: You need to write the letters on graph paper or in an Excel spread sheet in order to understand how many spaces are needed. To understand how the arrays should be initialized look at chapter 10 objective 7 above. You do not need to reproduce the grid lines in your program's output.

      
  0 1 2 3 4 5 6 7 8 9 10
0           A          
1         A   A        
2       A       A      
3     A A A A A A A    
4   A               A  
5 A                   A
     
 
GridWorld: Read Chapter 2, Exercises 1-4

Test: Chap 12 Objectives 1-16