IBCS1 - 1112 - May
From WLCS
Contents
Thursday (5/31/12)
- Java class creation review
- Media:IntroClasses.ppt
- Circle class practice
- Rectangle class practice
- Contact class lab assignment
Tuesday (5/21/12)
- Make sure you have completed:
- 10 problems in Java-Array-1
- 6 problems in Java-Array-2
- Object-Oriented Programming in Java (Introduction to Classes)
- Media:IntroClasses.ppt
- Circle class practice
- Rectangle class practice
- Contact class lab assignment
Thursday (5/17/12)
- Complete at least 10 problems in Java-Array-1
- Complete at least 6 problems in Java-Array-2
Friday - Tuesday (5/11/12 - 5/15/12)
Agenda:
- Demo Java Functions Practice
- Half of the class has yet to complete 9 exercises from Java->String-2
- Introduction to Java Arrays
- Walk through a couple array problems
- Complete at least 10 problems in Java-Array-1
- Complete at least 6 problems in Java-Array-2
- If you are a senior, please complete the following surveys:
Monday - Wednesday (5/7/12 - 5/9/12)
- Methods & functions in Java
- Do you want the method/function to be usable by other files?
- Yes - public
- No - private
- static (just put it there)
- Do you want the method/function to return anything?
- Yes - put the return type (e.g. int, double, String, etc.)
- No - void
- 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)
- 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)
- Do you want the method/function to be usable by other files?
- Java Functions Practice
- 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)
- 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)
- 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
- 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)
- Demo the following today: