Information for homework, projects, and tests for the 2014-2015 school year
Showing posts with label loops. Show all posts
Showing posts with label loops. Show all posts
Saturday, October 4, 2014
Homework 3.2 - computePower
Click link for Homework 3.2 - computePower
Thursday, October 2, 2014
Monday, September 29, 2014
Homework 3.1
Homework - Lesson 3.1 Parameters
Due 9/30/2014
-
In eclipse, create a new class called “FirstnameLastnameHwk3_1”, where “FirstnameLastname” is your first name and last name. Include a main method when you create your class.
-
Create a method called “computeSquare” that has 1 integer parameter. The parameter variable name should be “square”
-
In computeSquare method, multiple “square” by itself and then println the result.
-
In your main method, call computeSquare 4 different times. The first time, pass in the number 1. The second time, pass in the number 2. The third time, pass in the number 3. The forth time, pass in the number 4.
-
Run your program, the results should be:
1
4
9
16
-
Extra Credit, in your main method, remove the previous calls to computeSquare and write a for-loop that will call computeSquare 4 times (make 4 a constant variable in main and name it “NUMBER_OF_SQUARES”). Have the iterator start at 1 and pass the iterator as the parameter to computeSquare.
-
Run your program, the results should be:
1
4
9
16
-
Email your file to hw-cs-castlemont@googlegroups.com
In eclipse, create a new class called “FirstnameLastnameHwk3_1”, where “FirstnameLastname” is your first name and last name. Include a main method when you create your class.
Create a method called “computeSquare” that has 1 integer parameter. The parameter variable name should be “square”
In computeSquare method, multiple “square” by itself and then println the result.
In your main method, call computeSquare 4 different times. The first time, pass in the number 1. The second time, pass in the number 2. The third time, pass in the number 3. The forth time, pass in the number 4.
Run your program, the results should be:
Extra Credit, in your main method, remove the previous calls to computeSquare and write a for-loop that will call computeSquare 4 times (make 4 a constant variable in main and name it “NUMBER_OF_SQUARES”). Have the iterator start at 1 and pass the iterator as the parameter to computeSquare.
Run your program, the results should be:
Email your file to hw-cs-castlemont@googlegroups.com
Friday, September 26, 2014
Study Help Screencasts from Your Peers!
Mad props to Lauren, Sandra, Evelyn, and Elvis who made screencast of some today's review problems. They explain their thinking and how they arrived at their answers. Watch them as review for your QUIZ on MONDAY. The slides are posted underneath the videos.
Elvis explains nested for loops
Elvis explains for loops
Sandra and Evelyn explain operators and assignment
Sandra and Evelyn explain nested for loops
Lauren explains for loops
Subscribe to:
Posts (Atom)