Intro to Java 2014-15
Quarter 4
2-d Arrays
Objects in Java
- Objects in Java
- Constructor, what it is, and what’s role is
- default value of datatypes
- instance vs local variables and defaults
- private vs public
- Student Assignment
Quarter 3
Unit 1 : Java
- Compiler, interpreter, byte and source code
- Problem Solving Process
- Java String Assignments 1
- 20 question from Coding Bat – String 1 , due before class Wednesday the
- 20 Array 1 done before class Monday March 9th
- Array Fun 2 : do the first 1 by end of break
- Array Fun 1 (Mr m site) we’ll do after break.
- Array 2 (Codingbat)
- sum 13 : http://codingbat.com/prob/p127384
- sum 28 : http://codingbat.com/prob/p199612
- Only 14 : http://codingbat.com/prob/p186672
- Lucky 13 : http://codingbat.com/prob/p194525
- more 14 : http://codingbat.com/prob/p104627
- centered ave : http://codingbat.com/prob/p136585
- Hints
- isEverywhere()
- Test corrections (50% points back, due on Monday 27th). Hand in
- original test
- updated/correct code clearly labelled
- Array 2 (Codingbat), Complete 14 exercises (100% if 7 of 14 are from last 5 full rows , starting with matchup ). You cannot include exercises that we did together in class.
- Download Arrays In Memory
- pre4 coding bat
- Friday 22nd
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
upToN(5) = { 1,2,3,4,5} upToN(7) = { 1,2,3,4,5, 6, 7} upToN(8) = { 1,2,3,4,5,6,7, } public int[] upToN(int n){ int[] myArray = new int[ n ] ; for( int i = 1 ;i <= n ; i++) { if( n % i == 0) // store 'i' into the array System.out.println ( i ) ; } return myArray; } |
25h
bool isLeapYear(int yr) Create a function bool isLeapYear( int yr) that returns true if the year is a leap year, false otherwise
- in main() you should ask the user for a number and then send that number to the isLeapYear() function . Read this page for the leap year algorithm.
Create a Leap Year calculator. Ask the user for a year and determine the number of leap years that have occurred from between 1581, the first leap year, and the year that the user entered.. You may assume that the input is a number, but you are responsible for ensuring that the number is a valid number (ie not before 1581 etc..)
Tip for testing your program: Try numbers that are multiples of 400, 100 and 4 .
Quiz/Test on Wed November 5th
- definition of pass by value
- definition of pass by reference
- parts of a function , return value (void vs int)
- be able to state the output of running code (like our classroom examples)