Our sections are 50-minute discussions led by section leaders each week in which the SL and students work together to solve problems. The complete list of section leaders, their contact information, and the time/place/room of each section can be found on the Staff page of this web site, though you should have already received an email containing that information for your section.
We will not hold section during the first week of the quarter. Sections begin during Week 2.
No pre-section problem this week. You will receive full section participation credit for this week if you just attend your section and take part in working on the problems.
Pre-section problem: Solve the following problem on paper (hand-written or printed) and bring your sheet of paper to your section. This problem does not come from the textbook.
The following screenshots show the effects of these buttons.
Assume that you are starting from the given skeleton program.
Our own solution adds 14 total lines of code to the skeleton below:
one field, 6 lines in init
, and 7 lines in actionPerformed
.
(You can also download the code below if you want to type it in.)
public class Shining extends Program { // fields public void init() { // TODO: implement } public void actionPerformed(ActionEvent event) { // TODO: implement } }
No pre-section problem this week: Since you're busy this week studying for the midterm exam, there are no pre-section problems to do this week before your section. You will receive full section participation credit for this week if you just attend your section and take part in working on the problems.
Pre-section problem: Solve the following book exercise problem on paper (hand-written or printed) and bring your sheet of paper to your section:
The book exercise says to accept an array of double
as your parameter.
But instead, write a version that accepts an ArrayList
of double
s.
If the list is empty, your method should return 0.0
.
The book also says to test your method by incorporating it into a GymnasticsJudge
program; you don't need to do that.
If you want to test your code, download our ZIP file below.
Pre-section problem: Solve the following book exercise problem on paper (hand-written or printed) and bring your sheet of paper to your section:
Pre-section problem: Solve the following book exercise problem on paper (hand-written or printed) and bring your sheet of paper to your section:
countDigits(n)
that ..."
(See book Figure 4-6 for a helpful example to get you started.
Can you write a version that handles negative numbers?)
Pre-section problem: Solve the following book exercise problem on paper (hand-written or printed) and bring your sheet of paper to your section:
Write a variation of the book's exercise where you print all of the numbers in the range, separated by spaces. Use a loop to print the numbers. But for multiples of three print "Fizz" instead of the number, and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz". The output would be:
1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz 16 17 Fizz 19 Buzz Fizz 22 23 Fizz Buzz 26 Fizz 28 29 FizzBuzz 31 32 Fizz 34 Buzz Fizz 37 38 Fizz Buzz 41 Fizz 43 44 FizzBuzz 46 47 Fizz 49 Buzz Fizz 52 53 Fizz Buzz 56 Fizz 58 59 FizzBuzz 61 62 Fizz 64 Buzz Fizz 67 68 Fizz Buzz 71 Fizz 73 74 FizzBuzz 76 77 Fizz 79 Buzz Fizz 82 83 Fizz Buzz 86 Fizz 88 89 FizzBuzz 91 92 Fizz 94 Buzz Fizz 97 98 Fizz Buzz
("FizzBuzz" is a commonly known problem. Many companies actually ask their interview candidates to solve it, and surprisingly a large number of applicants are unable to do so. It's considered a good "weed-out" problem because anybody with a CS degree ought to know how to solve a problem like this.)
You can just write out the code by hand and make your best attempt to solve the problem. If you want to actually code up the solution in Eclipse, you can do so using our starter project ZIP below, but you don't have to do so. If you type it in, you'll need to print it out or rewrite it by hand so that you can turn it in on paper at your section; we do not accept it digitally such as by email. If you like, you do not need to write a complete program; just the relevant lines of code to answer the question. (See detailed information below about pre-section problems.)
Keep in mind that these pre-section problems are meant to be short warm-up drills to get you ready for section. They are not meant to take a large amount of time or cause you undue stress. If you're taking more than 15-20 minutes on this problem, you can stop and give your partial work to your SL and you will receive credit.
Solve the following book exercise problem on paper (hand-written or printed) and bring your sheet of paper to your section:
1 + 2 * 3 + 4 ----- 1 + 6 + 4 ------- 7 + 4 ---------- 11
You can just write the answer(s) by hand and make your best attempt to solve them.
(The "Section 1 Handout" problems from the PDF document above are the problems that you'll work on in your section this week with the section leader. You don't need to work on any of those before your section, though you can optionally read them ahead of time if you like.)
Pre-section problems: Each week you will complete short problem(s) from the book to turn in at your section. Completing these problems each week becomes part of your "participation" score which is part of your grade. Another part of your "participation" score is 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.
If you want credit for doing the problems, you must bring the solutions on paper, not email them digitally to your SL. Also, you must bring them yourself, not have a friend bring them for you. Pre-section problem solutions are not accepted late.
Our intention is that these problems would take no more than 15-20 minutes each week. If you find yourself taking significantly more than this, you may stop your work and write that you worked for 20 minutes. If you have made significant progress, we will still give you credit for your work even if you did not finish the problem(s).
You are expected to follow the Stanford Honor Code.
Remember that we run similarity-detection software over all solutions, including this quarter and past quarters, as well as any solutions we find on the web.
If you need help solving an assignment, we are happy to help you. You can go to the LaIR, or the course message forum, or email your section leader, or visit the instructor / head TA during office hours. You can do it!
See Course Information handout for full Honor Code policies, or email us if you have any questions.