lecture11-methods+notes

lecture11-methods+notes - Lecture 11: Methods (wrap-up) CS...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Lecture 11: Methods (wrap-up) CS 170, Section 000 1 October 2009 10/2/2009 CS170, Section 000, Fall 2009 1 Lecture Plan square4 Logistics square4 Common errors in using variables, loops, methods head2right Program design using methods square4 top-down square4 bottom-up head2right case studies head2right Midterm coverage 10/2/2009 CS170, Section 000, Fall 2009 2 Logistics Midterm 1 : Tuesday, October 6 th Will include material in Chapters 1 through 5 Exact sections covered specd later; also to be posted Homework 2 solutions to be posted by end of week (in time for you to study for midterm). Optional Review/Seminar (come with questions) Monday afternoon, October 5 th 4:15pm-6pm in room W301 (next door) 10/2/2009 CS170, Section 000, Fall 2009 3 Common Errors in Variables, Loops, Methods Variables square4 Common errors: scope, assignment, logic/semantics square4 Methods Common errors: declaring and implementing, calling, parameters Loops common errors: terminating conditions, incrementing vs. decrementing counter 10/2/2009 CS170, Section 000, Fall 2009 4 Variables: defining vs. using head2right int Number; // definition head2right Number = 12345; // usage Every variable that you use in a Java program must be defined before its first usage. head2right Example: compute area (area=pi*r*r) 10/2/2009 CS170, Section 000, Fall 2009 5 Variables: defining vs. using head2right int Number; // definition head2right Number = 12345; // usage Every variable that you use in a Java program must be defined before its first usage. head2right Example: float pi, radius, area; // define variables area = pi * radius * radius; //get value of pi , radius // compute result of expression // store result in area 10/2/2009 CS170, Section 000, Fall 2009 6 Scope of Local Variables 7 A local variable: a variable defined inside a...
View Full Document

Page1 / 30

lecture11-methods+notes - Lecture 11: Methods (wrap-up) CS...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online