AP Computer Science A - PowerPoint PPT Presentation

1 / 48
About This Presentation
Title:

AP Computer Science A

Description:

Today we will reflect upon the strengths and weaknesses of this class last ... Collect Missing Assignments. Finishing the Chapter- Interfaces ... – PowerPoint PPT presentation

Number of Views:256
Avg rating:3.0/5.0
Slides: 49
Provided by: lbusd
Category:

less

Transcript and Presenter's Notes

Title: AP Computer Science A


1
AP Computer Science A
  • Jacobson
  • Week 1
  • Second Semester

2
Agenda
  • First Semester- Reflections
  • Book Check (For Real)
  • Marine Biology Case Study
  • Chapter 1
  • Homework
  • First Semester Grades

3
Objectives for Today
  • Today we will reflect upon the strengths and
    weaknesses of this class last semester, in both a
    verbal and written form.
  • You will also observe, report and analyze the
    running marine biology case study.

4
Reflection of First Semester
  • Fold a piece of paper (that you will turn in) in
    half like a hot dog
  • On the left, brainstorm all of the positive
    aspects of last semester.
  • On the right, brainstorm all of the roadblocks to
    your learning or things that could be better.

5
Share with Class
6
Mr. Jacobsons Reflections
  • Positives
  • Hard work- Diligence
  • Problem solving skills are starting to show
  • Semester Project

7
Mr. Jacobsons Reflections
  • Negatives

8
Mr. Jacobsons Reflections
  • Semester Project
  • Great Job following directions
  • Needs more work on Object Oriented Programming
    concepts
  • Needs more work on algorithms
  • Battleship tutorial only helped 1 or 2 groups

9
Mr. Jacobsons Reflections
  • Places for Change
  • More responsive assessments
  • More student participation
  • Less distractions

10
Book Check
  • Collect all Simply Java
  • Check the number of the other textbook

11
Marine Biology Case Study
  • What is the purpose?
  • Background
  • Chapters 1-4 in the Acrobat File for our class
  • Getting it running
  • Making Observations
  • Class discussion

12
Marine Biology Case Study
  • Getting it running

13
Warm up
  • Assume that x is an initialized int variable.
    The code segment
  • if (x5) x2
  • if (x10) x 0
  • Is equivalent to which of the following code
    segments?
  • x 0
  • if (x 5) x 0
  • if (x 5) x 2
  • if (x 5) x 0 else x 2
  • if ( x 5) x 2 else if (x 10) x 0

14
Agenda
  • Finish Chapter 1 Case Study
  • Work together
  • Class discussion
  • Truth Tables

15
Case Study
16
(No Transcript)
17
Objective-Truth tables
  • Today you will make a truth table for a complex
    logical expression and apply that to java
    programming.

18
Truth Tables
  • What data type is either TRUE or FALSE?
  • boolean
  • What types of statement evaluate an expression
    that is either TRUE or FALSE?
  • if statements
  • while loops
  • For loops

19
Simple Comparisons
  • ( total sum )
  • (x
  • ( str.charAt(0) ! str.charAt(9) )

NOTE Here total, sum and x could be integers or
doubles. str is a String and the method
charAt() returns a character for
comparison. When there is only one comparison in
the whole expression, it is easier to understand
20
More Complex- Truth tables can help
  • ( (X 20) (X
  • statements are true only if both parts are
    true

A B A B T T T T F F F T F
21
More Complex- Truth tables can help
  • ( (X 20) (X
  • statements are true if one or the other is
    true

A B A B T T T T F T F T
T F F F
22
More Complex- Truth tables can help
  • ( (X 20) ! (X

A B !B A !B T T F F T F T
T F T F F F F T F
23
Make a truth table
  • Make a truth table for the following expression
  • !A !B
  • A B !A !B !A !B
  • T T F F F
  • T F F T F
  • F T T F F
  • F F T T T

24
Equivalent Expressions
  • Two expressions are logically equivalent if their
    truth tables reveal that the same input results
    in the same output
  • ! ( A B) is equivalent to !A !B
  • Where A and B are logical expressions

25
HW
  • From Book- p. 177 3.2, 3.3, 3.9, 3.10
  • Explain your answers in detail. (Hint- Make some
    type of truth table)
  • Due at beginning of next class

26
Warm up
  • 1. Consider writing a program to be used by a
    restaurant to keep track of the items on the
    menu, which include appetizers, main dishes and
    desserts. The restaurant wants to keep track,
    for every menu item, of the ingredients needed to
    prepare that item. Some operations will be
    implemented that apply to all menu itemsm and
    there will be some specialized

27
Warm Up
  • Consider the following two methods
  • public static void printStuff(int x)
  • int y1
  • while (y
  • System.out.print(y )
  • y 2
  • if (y x/2) return
  • public static void mystery( )
  • int x 8
  • while (x 0)
  • printStuff(x)
  • x / 2
  • System.out.println(x x)
  • What will be the output when method mystery is
    called ?
  • 1 2 1 1 1 x0
  • 1 2 1 1 x0
  • 1 2 2 x0
  • 1 2 4 x8
  • 1 2 x8

28
Warm up picture
printStuff (int x) x y
Mystery x
OUTPUT
29
Agenda
  • Warm Up
  • Collect HW
  • Chapter 4 Review- Group Presentations
  • Sections 4.0-4.5, 2.6, 2.0
  • 30 minutes to prepare
  • 5 minutes or less to present

30
HW- you may start in class as needed
  • P.240 true-false questions
  • Provide justification for your answers
  • Give counterexample if false
  • Give explanation if true
  • Read-Notes 248-255 (Start Chapter 5)

31
Agenda
  • Study Session
  • Tracing the Code- Continued
  • static modifier
  • static variables
  • static methods
  • HW- p.293 5.1-5.9 T-F Give Explanations
  • Notes- up to section 5.4

32
Study Sessions
33
Tracing the Code
  • Where were we last time?
  • Parameter Passing Example
  • Pages 253-255

34
Agenda 2-17-06
  • Collect HW
  • Programming Projects p.294 5.1
  • Finish the Chapter
  • interface
  • Making one
  • Using one

35
Agenda 2-22-06
  • Collect Missing Assignments
  • Finishing the Chapter- Interfaces
  • Programming Projects (Due by end of next class)
  • P.294 5.2, 5.6, 5.7
  • Test Chapter 4-5 (up to 5.4) Tuesday Feb 28th

36
Time to Imagine
  • Imagine a bunch of 4 year olds in the middle of
    a basketball court

37
Time to Imagine
  • And the adult in charge says OK, RUN!!!
  • What will happen?

38
Time to Imagine
  • Now imagine the same set up with the following
    exception

39
Time to Imagine
  • A series of walls are put up. What will the kids
    do in this case?

40
In Programming Chaos Should be avoided
  • There needs to be some way for programmers to be
    organized and consistent
  • One way this can be accomplished is through a
    well designed interface.

41
interface - what is it?
  • An interface looks like an empty class
  • All methods are abstract and public
  • Headers for methods are listed but not
    implemented
  • An interface has no data members
  • An interface may have constants
  • public static final data

42
More on interfaces
  • To use an interface for a class you are creating,
    you use the keyword implements
  • When a class implements a specific interface, it
    must create the details for each method that was
    listed in that interface.

43
Example
  • Suppose you wanted to write a Geometry program
    about shapes. Ultimately, your program will be
    able to create and measure properties of many
    shapes, such as circles, squares, trapezoids, and
    possible a shape you do not know about yet.
  • Thinking abstractly what is something you would
    want to know about any shape in the program?

44
Shapes interface
  • You can design a Shape interface that would
    force anyone who introduces a new shape to write
    code in an organized way.
  • public interface Shape
  • public double getArea()
  • public void printCenter()
  • public void makeVisible()

45
Shapes interface
  • You can design a Shape interface that would
    force anyone who introduces a new shape to write
    code in an organized way.
  • public interface Shape
  • public double getArea()
  • public void printCenter()
  • public void makeVisible()

If I implement this interface, I will have to
make at least 3 methods
46
AP Java Subset
  • For the AP-A course, you need to be able to
    implement the Comparable interface
  • It only has one method
  • Int compareTo( Object obj)

47
Agenda 2-24-06
  • Finish 5.2 - 5.6 - 5.7 Be ready to show me by
    845
  • Test Next Tuesday
  • Similar format to the quizzes
  • Multiple Choice
  • Trace the code
  • Write a method
  • Notes- Power Point posted online

48
Test Topics
  • Chapter 4
  • Chapter 5 up to 5.4
  • Example of Parameter Passing
  • Objects vs. Primitive types
  • Example of implementing the Comparable interface
Write a Comment
User Comments (0)
About PowerShow.com