Week 1 (Review)
All homework for Week 1 is optional.
- CodingBat: shiftLeft
- CodingBat: tripleUp
- CodingBat: seriesUp
- CodingBat: copyEvens
- CodingBat: fix34
- Exercise: 10.7, 10.9, 10.10
- CodingBat: lucky13
- CodingBat: sum28
- CodingBat: centeredAverage
- The above centeredAverage problem with an ArrayList instead. (
public int centeredAverage(ArrayList<Integer> nums)
) - CodingBat: linearIn
- Exercise: 10.10
- Project: 10.2
- Project: 10.7
Week 4 -- due in class Tuesday of Week 5
This homework assignment is especially designed to help you get more practice with the material.
Week 6 -- due in class Wednesday of Week 7
Requirements for this and future homeworks for full credit- Must be turned in at beginning of class
- Must be stapled if multi-page
- Emailing not accepted any more
- Reference questions by number in list below except for printed code. (No need to repeat the assignment, though you can if you want to.)
- Write the problems in order
- (Add your own clarity & cleanness requirements here)
The assignment:
- Is this a legal assignment? (Will it compile?)
Object o = new JButton();
Why or why not? - On exam I, problem 11, why is a cast to the Circle type required to Circle or Shape required when implementing the Circle class's equal method? (If you do not have a copy of exam I, please ask me or infer the problem from what's here.)
- In the statement
JButton b1 = new JButton("Hello");
JButton b2 = b1;- How many buttons are created? Why?
- But there are two button variables! How can that possibly be the answer? (Explain)
- Is an Interface a Class? Answer either yes or no, and support your claim.
- Into IntelliJ, include an instance variable in an interface. You can even make it public! Can you set this variable from main? (Does it work?) Provide theory to support your experiment. (One sentence is fine.)
- Redo this assignement from last week: Get your example JFrame application to compile with two components. You should have at least one component respond to a users action. This is just completing an in-class example, no more than that. Then print your source code and include it with your homework. (I will return your previous assignment, so you can simply re-use last week's if it worked.)Hints: Implement ActionListener. See in-class examples
- Implement the "max" method from scratch. Given an ArrayList
or ArrayList , write a method to find the maximum int (or longest toot) without using collections. If you have already done this, just copy-paste your solution from the lab. (Ideally your lab will already have a method taking an ArrayList of T00ts, so the code is easily re-usable.) Hint: You only need to walk over the list once, and temporary variables can be helpful. - What does the
Week 7 -- due in class Wednesday of Week 8
This material will be covered on the exam. If you turn in the HW on Wednesday of this week, I will return it in class on Thursday.
Homework proper
Fill out the example exam and turn it in as follows:
- Type your solution to all of the problems into the word doc.
- Save the Word Doc as PDF
- Upload you PDF file here
- If you do this by 6pm today, I will give you brief comments on your work tomorrow
- Otherwise, it is due in hard copy, in class Wednesday of next week
In class (optional)
This optional homework was specifically designed for Week 7, Class 1.
From the book:
- Excercise 15.1 from the book (Chapter 15, exercise 1). This is a code-reading problem. We worked the highlighted problems in class
- Ex 15.2 (code reading, simple extension of 15.1)
- Ex 15.3 (code writing)
- Ex 15.4 (code writing, deeper than 15.3)
- Ex 15.6 (rearrange catch blocks) (There are multiple correct solutions)
- Ex 15.7 (Fig. 15.14 on pp. 685-686)
- Ex 15.8 (code reading)
Ex 15.9(haven't covered this yet)
Week 8 HW (due Week 9, Wednesday, in class)
Print this handout and fill in your answers. If you staple the assignment, you do not need to write your name on each page. (And stapling is a requirement.)
See submission instructions from previous two weeks
Week 9 HW (due Week10, Thursday)
Acknowledgement
Dr. Taylor wrote the Week 1 homework assigment, and some of the other problems as well. Some problems are inspired or directly copied from the book. These are not cited to reduce the confusion about how they should be numbered when turned in.