Mr. Rogers AP Computer Science A - First Quarter Objectives

 

Essential Question: How do you create a program?

Chapter 1 & 2: Software Basics

(AP Computer Science Standard: II Program Implementation, III Program Analysis, VI Computing in Context)

First Day

Introduction - View Mr. Rogers AP Computer Science Syllabus (google mr rogers comp sci. Syllabus is 1st link.) and set up Bluej (click on the picture of the blue jay shown below).

  1. Create a project in Bluej that uses console output (System.out.println)

Programming Assignment 1: Using the Bluej IDE, Create a project called Hello with a class also called Hello. Write a program that outputs "Hello World" to the screen.? 

(Click here to see the code.)

Key principles to review:

  1. Define the term debugging.Debugging is the process of correcting the compiling, run-time, and logic errors in a program so that it performs as desired.
  2. Define compiling error and describe a way to cause one. While compiling errors give error messages, be aware that the messages can be very misleading. Do not depend on them.

Deliberately delete a ";" from the above program and note the error message. Deliberately alter other elements of the program to see what happens

 

Essential Question: What features make Java special?

Second Day

  1. Explain what compilers and interpreters do and why compiled code generally runs faster. Compilers convert code to a lower level form (the lower the level the less understandable to humans) all at once and only once before the code is run on a computer. Interpreters convert individual lines of code just before they run. Any part of the code that's repeated--a common practice--has to be converted multiple times, thus slowing down the computer it runs on.
  2. Describe how Java's source code is compiled to byte code and then interpreted by the Java virtual machine which converts the byte code to a computer's machine language.
  3. Give examples of different operating systems and explain why the Java virtual machine is needed. The Java VM makes it possible to write code once and run it on any operating system (OS). Otherwise, the code has to be specifically written for each type of OS. Most programming languages have a version that can be run using the Java VM.
  4. Use one or more examples to explain why Java ain't algebra.? 
Programming Assignment 2:Create a new project called JavaAintAlgebra with a class of the same name. Delete all the code in the class. Replace it by copying and pasting the code in this link inside.
  1. Predict what the code will output if word = "stuff" and num = 1
  2. Run the code and input a string called "stuff" and the integer 1. Note: Strings are objects that contain text. Enclosing text in double quotes creates a string. example: "This is a string." This is not a string.
  3. Uncomment (delete the double forward slash) the following line in the program:
    // num + 1 = result ;

  4. Then try to re-run the program. What happens.
  5. Repeat ten times to yourself, "Java ain't algebra."

Key principles to review:

Essential Question: What is a run time error?

  1. Define run-time error and describe a way to cause one. The program compiles but does not run. Usually gives an error message. This is called throwing an exception.

    Programming Assignment 3: Write a program that inputs (your name) and (your age) on the command line and outputs "Hello (your name) you are (your age) years old".

    Deliberately cause a run time error in?  the above program and note what happens.

Programming Assignment 4: Modify the above program so that it does the output using a method called output. Pass the information about your name and age from the main method into the output method.

Deliberately cause a run time error in the above program and note what happens.

Essential Question: What does a loop do?
  1. Define the term iteration and describe a way to repeat them. An iteration is a set of steps or actions that are repeated. Iterations can be repeated using loops such as the "for loop".

example: in pounding a nail, each time the nail is struck by the hammer is one iteration.

Sample code: (Note, putting // before a line of code makes it a comment. Comments are ignored when a program is run.)

for (int x = 0; x < 10; x ++) {

// Insert your lines lines of code between
// the curly brackets.

}

Formative assessments:

Programming Assignment 5: Modify Programming Assignment 2 with a "for loop" so that the message repeats itself 10 times.

    once the program is running, modify it so that it has an infinite loop and see what happens when you run it.
  1. Change System.out.println to System.out.print and note what happens. alter your code by adding a ; as shown below and note what happens.
 

for (int x = 0; x < 10; x ++) ; {

 

 

 
  1. Define logic error and describe a way to cause one. The program compiles and runs but does not run correctly. This is the worst type of problem because it gives no error messages or exceptions.
  2. Be aware that while a program can branch to a different part of the code or go round-and-round in a loop, it otherwise executes sequentially from the top to the bottom for a given method.

 

Essential Question: What do classes and methods do and why are they important to functional decomposition?

Remainder of Week

  1. Describe one of the key strategies in the creation of complex software: functional decomposition (breaking down an overwhelmingly complex task into smaller doable tasks). Note: Creating a a software project of even a few hundred lines of code rapidly becomes complex if not overwhelming. The key to success is to take baby steps.
  2. Define encapsulation and information hiding.

Programming Assignment 6: Set up and run the Hello2Class project (click on the links in the blueJ screen shot show below).

a) Try eliminating the word static found in the boys class and note the effect.

b) Set up a "for loop" that calls the talk method in the girls class 3 times.

c) Create a Parent class with a talk method that not only outputs a unique message but also calls the girls talk method. Call the Parents talk method in the Hello2Class class.? ? 

d) Give an example of encapsulation from the program.

f) Give an example of information hiding from the program.

 

 

Essential Question: What is Gridworld and why learn about it?

  1. Complete the first chapter of the AP Computer science case study GridWorld.

Note: Mastery of the case study often means the difference between a 4 and 5 on the AP Exam. Start early and give it priority!

  1. Know how the squares or cells in GridWorld are numbered.

Assignments: The below assignments are to be completed within the first 10 days of school.

All Homefun (sometimes improperly referred to as homework)?  assignments are to be turned in on the day of the test. They are to be stapled to the back of the test paper. The one exception are items on 3x5 cards. These will be checked separately one or more times each quarter. Late Homefun will NOT be accepted.

3x5 Cards are to be made in class on a daily basis students without 3x5 cards are not participating. The 3x5 indicates items that are especially3x5 card worthy.

Homefun (summative/formative assessment):

GridWorld: Read Section 1; Do exercises 1-4. Note: you will not understand all of the terminology. Don't worry: your not supposed to. However, you'll find that if you don't let the jargon bother you, you can muddle through. In programming, muddling is a highly valued art. In the past, a good working knowledge of the case study has often made the difference between a 4 and a 5 on the AP Exam.

Each Programming assignment is to be set up in a separate project and placed on your student virtual hard drive on or before the day of the unit test.

Programming Assignment 7: Write a program that receives three input characters via command line input and outputs your printed initials in large size (at least 2 inches high) using the 3 input characters stored in string variables. Note: you need to write the initials on graph paper in order to know how many spaces to put between the string variables.

Example 1:

Input: "T", "K", "R"

Output:

T T T T T   K     K   R R R R
    T       K   K     R     R
    T       K K       R R R R
    T       K   K     R   R  
    T       K     K   R     R

Example 2:

Input: "X", "Y", "Z"

Output:

X X X X X   Y     Y   Z Z Z Z
    X       Y   Y     Z     Z
    X       Y Y       Z Z Z Z
    X       Y   Y     Z   Z  
    X       Y     Y   Z     Z

Programming Assignment 8: Write a program that uses a "for loop" to output a quilt-like pattern out of characters. It should have at least 2 different patches, repeated twice.

example:

x x x o o o x x x o o o
x x x o o o x x x o o o
x x x o o o x x x o o o

Programming Assignment 9: Set up a project called BoomDemo with a single class called BoomDemo and insert the code shown here. Run the code then modify it as follows:

  1. Change the speed of the dots as they explode apart. (Note: the numbers cannot be higher than 255.)
  2. By modifying the code, determine the meaning of the 3 numbers used for representing new colors.
  3. Change the dot color to yellow (hint: google rgb yellow ).
  4. Add 3 new sets of dots, a pair that explodes vertically, a pair that explodes horizontally, and a pair that explodes along the opposite diagonal from the existing pair of dots.
  5. Google Java 7 graphics, select the 1st link, and choose a different shape for the dots. The 1st link will take you into the Java applications programming interface (API). It tells you how to use various features provided within the Java language. It is an awesome resource that you will frequently use.? 
  6. Do something of your own choosing to modify the program to your liking.
Optional Challenge: make the dots travel in non-linear paths.

See the modified BoomDemo program at right. This example has 2 dots--a white and a red one--that spiral outwards. The lines of code that erase previously drawn dots have been eliminated so that the dot paths are drawn on top of each other.

The program is slightly smaller than BoomDemo and illustrates how very complex patterns can be generated with a few lines of code.

Modified BoomDemo

Read Sections: 2.1 to 2.3 

Summative Assessment: Unit Test Chap 1 & 2 Objectives 1-14

Vocabulary Homefun: You must have at least one 3x5 card for each term. The information can be a definition or an analogy. Questions about the terms in orange bold type are generally found on the AP Exam and on Mr. Rogers' tests.

compiler calling a method machine language encapsulation
  interpreter debugging source code information hiding
  class compiling error byte code functional decomposition
  method run-time error Java virtual machine (VM) string
  field logic error IDE concatenate

 


 

Essential Question: What is a computer?

    Chapter 1 & 2 (continued): Hardware Basics

    (AP Computer Science Standard: VI Computing in Context)

  1. Define the terms:3x5

Name

Abbreviation

Number of Bytes

old

New

kilobyte kB 210 1,000 or 103
megabyte MB 220 1,000,000 or 106
gigabyte GB 230 1,000,000,000 or 109
terabyte TB 240 1,000,000,000,000 or1012

  1. State the basic types of gates and give logic tables for each. 3x5 http://scitec.uwichill.edu.bb/cmp/online/P10F/logic_gates2.htm

3 Person Group Assignment:

  1. Create a digital circuit using gates that describes an activity (must use both "and" as well as "or" gates, 5 gates minimum).
  2. Create an xor gate from "not", "and" and "or" gates.
  1. Correctly identify and describe the functions of the following components.

     

  2. Describe the function of ROM and the BIOS.
  3. Describe the function of a UPS (uninterrupted power supply, battery back up).
  4. Name the 2 most common I/O devices. (keyboard, monitor)
  5. Compare single user computer systems with Networks.

Read Sections: 1.1 to 1.4


Essential Question: How are numbers, letters, and colors represented in computers?

Chapter 1 & 2 (continued): How Information is Represented

  1. Describe the following number systems: binary (base 2), decimal (base 10), and hexadecimal (base 16). See How to Count to 1,023 on Your Fingers.
  2. Convert binary to decimal numbers.
  3. Convert binary to hexadecimal numbers. (see Hex Headquarters)
  4. Convert hexadecimal to binary.
  5. Convert hexadecimal to decimal numbers.
  6. State how characters are represented inside computers and give the name of the 2 types of code.
Code Type Bytes Possible Characters
ASCII 1 256
Unicode (used in Java) 2 65,536
  1. Describe how colors are commonly represented.
  2. Given a quantity of bits specify the largest number which can be represented. 3x5

max # = (2n - 1)

  1. Given a number of bits specify the largest number of objects or colors which can be specified. 3x5 max # of objects = 2n
Read Sections: 1.5 to 1.7
Homefun (summative/formative assessment):
Complete the Number Conversion and Unicode worksheet

Essential Question: What is the most important part of a piece of software's life cycle?
    Chapter 1 & 2 (continued): Software Design Basics

    (AP Computer Science Standard: I Object-Oriented Program Design)

  1. Use the two major computer program development tools.
  1. Use a flow chart to represent algorithms containing a loop
  • multiplication using only addition-- x?ˆ™y ?†’ Input x and y. Set product = 0 and add x to it y times. Output product.
  • division using only subtraction-- x/y ?†’ Input x and y. Set counter = 0. Subtract y from x and add one to counter. Repeat the process until x < 0.?  The quotient = (final counter value) - 1. The remainder = ( final x value) + y. Output the quotient and remainder.

Example: Flow chart for Hello <name> program that outputs 3 times using a for loop.

  1. Contrast procedural and object oriented programming. (Note: Java is object oriented.)
  1. List and explain the 6 phases of the Software System Life Cycle. Note that knowledge of the system's subject is often as important as knowledge of computing. 3x5
    • Analysis--identifying the needs to be addressed by the system--data collection.
    • Design--specifying the systems (both hardware and software) required to address the needs identified in the analysis step.
    • Coding--creating the actual code
    • Testing/verification--gone awry ... lobster people--Therac-25 !
    • Maintenance--fixing problems and responding to customer needs after the software is released to the customer.
    • Obsolescence--updating the software with a new version.

Prediction

In the near term future there will not be enough people with Computer Science degrees. The solution: Liberal Arts, Biology, Business, and other types of majors with any background in computing will be used to compensate. These people will have an increased number of job opportunities.

  1. Describe top-down design.3x5 Starts with an overview of the software that defines relevant subsections based on a well-developed understanding of the system to be created. The overview identifies the purpose and interface requirements of the subsections. Top-down design is similar to creating an outline for a writing project such as a book.
  2. Describe bottom-up design.3x5 Starts by fully specifying individual subsystems in detail. The subsystems are then eventually linked together into a complex project. These projects tend to grow in size and complexity over time as a greater understanding of the project evolves. Bottom-up designs have been compared to growing a plant from a seed.
  3. Describe key strategies in the test phase.3x5

Read Chap. 2

Homefun (summative/formative assessment):

Exercises 1, 6, p. 38

Use a flow chart to represent algorithms containing a loop

Programming Assignments:

Summative Assessment: Test Chap 1 & 2 Objectives 1-24--come prepared to write an applet on paper


Chapter 3: Introduction to Classes & Objects

(AP Computer Science Standard: I Object-Oriented Program Design, II Program Implementation)

 

Essential Question: What basic vocabulary is needed to talk about Java ?

 

Features in Java

  1. Correctly use the following terms and be able to identify them in a program and describe their purpose in a program. (reference: Oracle Java Glossary): 3x5
Essential Question: How are classes used in ways that facillitate the buiding of massive programs with large numbers of programmers?

 

  1. Explain why a class is like an operating manual for an object.

A class defines:

the properties of an object -- stored in fields and class variables.

what the object can do -- using methods

what can be done to the object -- using methods

Multi-class example

Classes: ClassRoomExample, People

  1. Create programs with multiple classes that include the use of:

    instances

    instance methods

    static methods

    overloaded constructors

  2.  

    Programming Assignment (summative/formative assessment):

    Complete the Pumpkin Project as specified in the Farm class using the Pumpkin class. Note that this is an application not an applet. Applications start using a main method.

     

Essential Question: What is an applet?

 

  1. State the type of program used for delivering Java programs over the internet and explain how it compares to other forms of delivering programs.

Applets reside on a server and are delivered over the internet by the server. However, when they run they run on your local computer, hence, there's no further load on the server. Applications reside on the hard drive of your local computer and run on your local machine. Server-side programs reside and run on servers, sending output to and receiving input from your local computer via the internet.

Because they are delivered over the internet, applets have security restrictions on them designed to prevent them from altering files on your local computer.

  1. Write a simple applet. (See AppletDemo Code. Run AppletDemo)

Homefun (summative/formative assessment):

Write brief definitions for the terms in objective 1 that are highlighted as follows: Term. Use the textbook and the Oracle Java Glossary. Next find a program(s) with examples of each of the terms in objectives 1 and identify them. You may use programs from the book, the internet, or ones you've written yourself. You may work as a group.

 

Programming Assignment (summative/formative assessment):

Write a really cool applet that moves three or more different types of graphic elements around the screen while changing their color and size. Output a stationary title for the applet in the center of the screen so that it is never obscured by the moving elements. The elements are to look like they move under the writing. Use a timer to control the speed of the animation.

 

Summative Assessment: Test Chap 3 Objectives 1- 4

 

Essential Question: How can you implement encapsulation and information hiding in ways that reduce the amount of source code?

Inheritance

  1. Explain how inheritance (uses the key word extends) works and why it is used. 3x5

    • superclass

    • subclass--"is-a" relationship (descendent relationship) examples: a car (subclass) is-a vehicle (superclass). A bus is-a vehicle. A truck is-a vehicle. The reverse is not true, for example, a vehicle is not a truck

 

Interfaces: Grades
  1. Explain the "has-a" relationship. (Used for defining fields) 3x5

client, characteristic, or component relationship examples: A car has a motor. A store has a customer. A girl has a name. A class has a field.

  1. Use "super" to call public methods of a super class from within a subclass.3x5

super.calculateHours ( double starTime, double stopTime);

  1. Be aware that private fields in a superclass cannot be accessed in subclasses except by using a public get method that resides in the super class. 3x5

example : super.getWeight ( ) ;
// returns the value of the superclass' private weight
// field to a place in the subclass.
  1. A superclass's protected fields can be used inside a subclass as though they were created in the subclass. Outside of the subclass, the field has to be access using a get method. 3x5

  1. Explain the term "primitive data types" and give examples. These are data types that are fully defined within the Java language. a primitive data type will have a fixed memory allocation (in other words number of bytes used for storage of the value).

examples: int, char, double

  1. Name four classes contained in the java.lang package which are automatically imported into your java programs.3x5

.
Read Chap. 3; Computational Thinking
.
Homefun (summative/formative assessment): After reading Computational Thinking (see the above link) write a two paragraph paper about it. In the first paragraph describe what computational thinking is. In the 2nd paragraph, compare computational thinking to mathematical analysis or thinking and describe the similarities and differences. Keep in mind that you may have to do additional google for and read additional articles to write the above paper.

Programming Assignment: Write an applet with a Human class, Student class, School class and a Grades interface. The Human class will have a field for IQ and a constructor that can give it a unique value. The student class will have fields for name, test1, test2, and average grade. It will extend the Human class. The student class constructor will have parameters for initializing all the fields except average grade. The grades interface will have a method for calculating average grades. The student class will make use of the method that calculates average grade from the grades interface. The school is to have 3 students created in the school class and is to output all the school's information in a table as follow shown in the following example:

Name IQ Test 1 Test 2 Average Grade
Bob 100 50 100 75
Jane  110 90  100 95
Martha  120 80 90 85

 

Summative Assessment: Test Chap 3 Objectives 1- 8

Relevance: Knowledge of object oriented programs (OOPs) is a highly useful employment skill The degree breakdown for computer/math scientists
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.