Sections

Each week you will complete problem(s) to turn in at your section. These problems will earn you 1 out of your 3 section participation points for the week. The other 2 points are awarded for being present in your section and participating in the discussion.

You will not be graded on whether you have a perfect solution, but on whether you have demonstrated effort. Therefore please show some work that demonstrates how you got the answer rather than just writing the answer by itself. We will be somewhat lenient about exactly how the work is shown.

Our intention is that these problems would take you up to 30 minutes each week. If you find yourself takin significantly more than this, you may stop your work and write that you worked for 30 minutes. If you have made significant progress, we will still give you credit for your work.

Section 10: Inheritance (Thu Dec 9)

Exercises: Solve the following Self-Check problem on paper and bring your sheet of paper to your section on Thursday: (You may not be able to solve it until after Wednesday's lecture, or you can read book section 9.3.)

1. Chapter 9, Self-Check Problem #9: Inheritance/Polymorphism Mystery (p618). In addition to writing the answer, also show your work by turning in a table of the methods and their output, similar to the one shown on page 585.

Section 9: Inheritance/Critters (Thu Dec 2)

Exercises: Solve the following three (3) Self-Check problems on paper and bring your sheet of paper to your section on Thursday:

1. Chapter 8, Self-Check Problem #2: what is an object, and how is it different from a class? (p548). Answer each part of the question in your own words.

2. Chapter 8, Self-Check Problem #15: problems with constructor (p549). Write the two major problems with the constructor shown, and then show a corrected version that does not contain these two problems.

3. Chapter 8, Self-Check Problem #18: copy constructor (p549). Write a `Point` constructor that accepts the parameter shown. You don't need to turn in the whole `Point` class, just a written copy of your idea for the constructor code.

Section 8: Canceled (Thu November 25)

There is no section this week due to the Thanksgiving holiday. There are also no "pre-section" problems to be completed this week. You can download and print this Section 8 Handout (PDF) to use as a study guide to learn the material from Chapter 8.

Section 7: Arrays (Thu November 18)

Exercises: Solve the following two (2) Self-Check problems on paper and bring your sheet of paper to your section on Thursday:

1. Chapter 7, Self-Check Problem #24: array simulation (p495). Write the final contents of each array after the method is finished executing. Show your work by writing the arrays' initial contents and then crossing out elements as their values change.

2. Chapter 7, Self-Check Problem #7: `max` (p492). Write a method named `max` as described. (NOTE: You can test your solution using our Practice-It system.)

Section 6: Canceled (Thu November 11)

There is no section this week due to the Veterans Day holiday. There are also no "pre-section" problems to be completed this week. Please attend Wednesday's lecture to get a pseudo-section handout of problems to help you prepare for Homework 6.

Section 5.5: Midterm practice (Thu November 4)

Exercises: Solve the following one (1) Self-Check problem on paper and bring your sheet of paper to your section on Thursday:

1. Chapter 5, Self-Check Problem #27: Logical Assertions (p366). Turn in a table or list with your answers. For each of the five labeled points in the program, write ALWAYS (A), NEVER (N), or SOMETIMES (S) for each of the three assertions. In addition to this, show your work by explaining very briefly why you wrote the answer you wrote for each point and assertion. (Example: You could write something like, "for Point C, assertion "`k > j`", the answer is SOMETIMES because the value of `k` is generated by a `Random` object so it could have any value.")

Section 5: `while`, `Random`, `boolean` (Thu October 28)

Exercises: Solve the following two (2) Self-Check problems on paper and bring your sheet of paper to your section on Thursday:

1. Chapter 3, Self-Check Problem #14: String method calls (p181). This problem shows several method calls on `String` variables and asks you to write the result that is returned by each call. Solve only expressions (a), (d), (e), (h), (i), (j), and (l).

2. Chapter 5, Self-Check Problem #3: `while` loop mystery (p358). Write the output of each call. Show your work by writing each value that each variable has as the code is running. For each call, make a table showing the values that `x` and `y` have as you execute the `while` loop for that particular call. For example, for the first two calls, the table look like this:

```mystery(1);                mystery(6);

x     y     z              x     y     z
_____________              _____________
1     1     0              6     1     0
...                        ...
```

Section 4: `if/else`, `Scanner`, return (Thu October 21)

Exercises: Solve the following three (3) Self-Check problems on paper and bring your sheet of paper to your section on Thursday:

1. Chapter 4, Self-Check Problem #3: `ifElseMystery1` (p290). The body of the method has an if, an else, and then a second if. For each call, show your work by writing which of these three blocks are entered for the given parameter values; then write the eventual output of the call.

2. Chapter 4, Self-Check Problem #2: logical expressions (p290). Write the results of the expressions (e), (f), and (g). These are the ones that begin as follows:

• `x + y > ...`
• `x - z != ...`
• `y * y <= ...`

Write an answer of `true` or `false` for each expression. Show your work by writing a very short phrase after your answer such as, "`x` is 7, therefore `x + 1` cannot be less than 5..." etc.

3. Chapter 4, Self-Check Problem #1: logical expressions (p289). This problem asks you to convert English sentences into logical tests. For example the sentence, "x is a positive integer," could be converted into the logical test, `x > 0`. Solve the sentences numbered (a), (e), (g), and (l). These are the ones that begin as follows:

• `z` is odd.
• `y` is a multiple of ...
• `y` is greater in magnitude than ...
• `x` is closer in value to `y` than ...     (Hint: Use the `Math.abs` method to help find the difference between two numbers.)

Write a logical expression for each of the above bullets. You do not need to show your work for this problem.

Section 3: parameters, graphics (Thu October 14)

Exercises: Solve the following two (2) Self-Check problems on paper and bring your sheet of paper to your section on Thursday. Show your work, such as by writing a table of what values are passed for each parameter to each call. Circle your final answer/output so it's clear which part is the answer vs. intermediate work.

1. Chapter 3, Self-Check Problem #5: `MysteryTouch` (p179)
2. Chapter 3, Self-Check Problem #4: `MysteryWho` (p178)

Section 2: expressions, `for` loops (Thu October 7)

Exercises: Solve the following two (2) Self-Check problems on paper and bring your sheet of paper to your section on Thursday:

1. Chapter 2, Self-Check Problem #2 (p117), solve expressions (a) - (e); from `2 + 3 *` ... through `(18 - 7) *` ...
2. Chapter 2, Self-Check Problem #3 (p118), solve expressions (a) - (c); from `4.0 / 2 *` ... through `12 / 7 *` ...

Please show some work rather than just writing the answer. Write out sub-expressions as you compute their values, and circle or underline operands to show precedence, as is done on page 69-70 of the textbook. You may use a calculator if you want, though one shouldn't be necessary for these problems. For example:

```2 + 19 % 5 - 11 * (5 / 2)

2 + 19 % 5 - 11 * 2

2 + 4      - 11 * 2

2 + 4      - 22

6          - 22

-16
```

Section 1: basic Java, static methods (Thu Sept 30)

No problems are due for the first week's section.