Difference between revisions of "IB Computer Science 1"

From WLCS
Line 60: Line 60:
 
** [[Print Shapes Exercises]]
 
** [[Print Shapes Exercises]]
 
** [[Looping Exercises]]
 
** [[Looping Exercises]]
 
== Friday (4/27/12) ==
 
* Demo the following in Java:
 
** [[Quadratic Formula Assignment]]
 
** [[MPAA calculator assignment]]
 
** [[Guessing Game Assignment]]
 
*** HINT: int r = (int)(Math.random()*100) //to generate a random number
 
** [[Print Shapes Exercises]]
 
*** HINT: System.out.print() //to print on a single line
 
*** Hint: System.out.println() // to print and go to the next line
 
** [[Looping Exercises]]
 
 
== Wednesday (4/25/12) ==
 
'''Agenda:'''
 
* Scanner Demo
 
** [[Media:ScannerDemo.java]]
 
* Mad Libs exercise
 
*# Prompt the user to enter a noun and store it in a variable named '''noun'''
 
*# Prompt the user to enter a verb and store it in a variable named '''verb'''
 
*# Prompt the user to enter another noun and store it in a variable named '''noun2'''
 
*# Print out a message that contains noun, verb, and noun2
 
* Circle calculations exercise
 
*# Prompt the user to enter the radius of a circle (this should be a double)
 
*# Calculate and print out the circumference of the circle.  Make sure your output looks like: "Circumference: ###"
 
*# Calculate and print out the area of the circle.  Make sure your output looks like: "Area: ###"
 
* Slope calculation exercise
 
*# Prompt the user to enter x1 (this should be a double)
 
*# Prompt the user to enter y1 (this should be a double)
 
*# Prompt the user to enter x2 (this should be a double)
 
*# Prompt the user to enter y2 (this should be a double)
 
*# Calculate and print out the slope
 
* [[Quadratic Formula Assignment]]
 
 
== Monday (4/23/12) ==
 
'''Warmup:'''
 
* Bring up your [http://codingbat.com/java/String-2 Java->String-2]
 
* Ask yourself, why are they not done?
 
 
'''Agenda:'''
 
* Be sure you have the following completed by now:
 
** 12 [http://codingbat.com/java/Warmup-2 Java->Warmup-1]
 
** 9 [http://codingbat.com/java/Logic-1 Java->Logic-1]
 
** 11 [http://codingbat.com/java/String-1 Java->String-1]
 
** 3 [http://codingbat.com/java/Logic-2 Java->Logic-2]
 
** 9 [http://codingbat.com/java/String-2 Java->String-2]
 
* Walkthrough of creating Java program in NetBeans
 
* [[Java program template]]
 
* [[Media:MathDemo.java]]
 
* [[Media:ConsoleInput.java]]
 
* [[Media:ConsoleInputExample.java]]
 
 
== Thursday (4/19/12) ==
 
'''Warmup:'''
 
* Complete the [http://codingbat.com/prob/p141494 Java > String-1 > startWord]
 
 
'''Agenda:'''
 
* Be sure you have the following completed by now:
 
** 12 Java->Warmup-1
 
** 9 Java->Logic-1
 
** 11 Java->String-1
 
** 3 Java->Logic-2
 
* Complete the first 9 [http://codingbat.com/java/String-2 Java->String-2]
 
** 6 will be from Python
 
 
== Tuesday (4/17/12) ==
 
'''Agenda:'''
 
* Java Practice
 
*# Convert 12 of your [http://codingbat.com/python/Warmup-1 Python->Warmup-1] exercises to [http://codingbat.com/java/Warmup-1 Java->Warmup-1]
 
*# Convert all 9 of your [http://codingbat.com/python/Logic-1 Python->Logic-1] exercises to [http://codingbat.com/java/Logic-1 Java->Logic-1]
 
* Introduction to Java Strings
 
*# Convert all 11 of your [http://codingbat.com/python/String-1 Python->String-1] exercises to [http://codingbat.com/java/String-1 Java->String-1]
 
 
'''Homework:'''
 
* Complete converting 11 of your [http://codingbat.com/python/String-1 Python->String-1] exercises to [http://codingbat.com/java/String-1 Java->String-1]
 
* Convert 3 of your [http://codingbat.com/python/Logic-2 Python->Logic-2] exercises to [http://codingbat.com/java/Logic-2 Java->Logic-2]
 
 
== Friday (4/13/12) ==
 
'''Warmup:'''
 
# Bring up Microsoft Word.  We will be creating a reference sheet
 
# Create a table with 3 columns and 6 rows
 
# Label the headers of the right two columns '''Python''' and '''Java'''
 
# On the left-most column, write out the following:
 
## comments
 
## boolean stuff
 
## print
 
## variable declaration and initialization
 
## if and else statements
 
## while loops
 
## for loops
 
## string stuff
 
## additional notes
 
 
'''Agenda:'''
 
* CodingBat Java Assignment
 
*# You will practice using Java syntax
 
*# We will be using the Java side of CodingBat from now on
 
*# Convert 12 of your Python->Warmup-1 exercises to Java->Warmup-1
 
*# Convert all your Python->Logic-1 exercises to Java->Logic-1
 
 
== Wednesday (4/11/12) ==
 
'''Agenda:'''
 
* Return work
 
* Introduction to Java
 
** [[Media:IntroJava.ppt]]
 
** [[Media:IntroJava2.ppt]]
 
* Programming with Netbeans
 
* CodingBat Java Assignment
 
*# You will practice using Java syntax
 
*# We will be using the Java side of CodingBat from now on
 
*# Convert 12 of your Python->Warmup-1 exercises to Java->Warmup-1
 
 
== Monday - Friday (4/2/12 - 4/6/12) ==
 
* Spring Break
 
  
 
== Archives ==
 
== Archives ==
 +
* [[IBCS1 - 1112 - April]]
 
* [[IBCS1 - 1112 - March]]
 
* [[IBCS1 - 1112 - March]]
 
* [[IBCS1 - 1112 - February]]
 
* [[IBCS1 - 1112 - February]]

Revision as of 07:02, 14 May 2012

Friday (5/11/12)

Agenda:

Monday - Wednesday (5/7/12 - 5/9/12)

  • Methods & functions in Java
    1. Do you want the method/function to be usable by other files?
      • Yes - public
      • No - private
    2. static (just put it there)
    3. Do you want the method/function to return anything?
      • Yes - put the return type (e.g. int, double, String, etc.)
      • No - void
    4. What do you want the name of the method/function to be?
      • Must be all one word, no spaces (follows same rules as variable names)
    5. Do you want the method/function to have any input parameters?
      • No - just have empty parentheses
      • Yes - declare the variable parameters and their types in the parentheses
    • Example template: public/private static RETURNTYPE FUNCTIONNAME(PARAMETERS)
    • Example: public static int functionName(int x, int y)
  • Java Functions Practice
  1. int compare(int a, int b)
    • Define a compare(int a, int b) function that returns 1 if a > b, 0 if a == b, and -1 if a < b
    • Test your compare function with 3 different function calls:
      • compare(5, 4)
      • compare(7, 7)
      • compare(2, 3)
  2. double hypotenuse(double a, double b)
    • Define a hypotenuse(double a, double b) function that returns the length of the hypotenuse of a right triangle given the lengths of legs a and b
    • Test your hypotenuse function with the following function calls:
      • hypotenuse(3, 4)
      • hypotenuse(12, 5)
      • hypotenuse(7, 24)
  3. double f2c(double t)
    • Define a function named f2c(double t) that converts the temperature parameter t from Fahrenheit to Celsius and returns it.
    • If you don't remember the formula to convert, then look for it online!
    • Create your own function calls that test the function
  4. double c2f(double t)
    • Define a function named c2f(double t) that converts the temperature parameter t from Celsius to Fahrenheit and returns it.
    • If you don't remember the formula to convert, then look for it online!
    • Create your own function calls that test the function

Tuesday - Thursday (5/1/12 - 5/2/12)

Archives