about | help | code help+videos | done | prefs |
Mr. Smith's Computer Science problems
All of Mr. Smith's custom problems have been relocated to the Custom Pages links below. Please go to the appropriate Custom Page that Mr. Smith has directed you to work.
Remember the structure of a CodingBat solution in my class, to keep you from skipping important information:
Step 1: create an output variable and assign it an initial value. This should be of the same data type as the method you are filling out, so if the method signature is public boolean areMyEyesClosed, the data type is boolean and you should create an output variable likeboolean output = false;You can name your output variable whatever you like.
Step 3: go to the bottom of the method and return your output variable. This is totally simple, make the last line of your method read as
return output;(assuming that your variable is called output) Yes, I'm asking you to do step 3 second, but it goes at the bottom so that makes sense.
Step 2: read the actual problem description and use logic to assign a new value to your output variable. This is likely going to include some combination of if statements and loops, and some problems are clearly more complex than others. This code should go in between the first statement (declaring an output variable) and the last statement (returning your output variable).
This is not the most efficient way to solve a problem, but it keeps you thinking about the important idea that each CodingBat problem is working its way toward returning an output variable of a certain data type. When you get to AP Computer Science A, remembering this method structure may save your behind on a handwritten free response question.
Custom Pages
|
Copyright Nick Parlante 2017 - privacy