Announcements
Software | Off the Shelf (reusable java code) |
Extra |
---|---|---|
Formatting with output code (demos String.format & printf) ( video ) |
UML templates
Java starting templates
About the Scanner ClassScanner Class - Reading input from console There's a scanner reading issue when you read an integer and then a string; its got to do with the newline character; here's a fix: scanner and the newline issue Scanner Class - Reading from textfiles ( source ) ( words.txt ) |
|
Datafilescodes.txt -- ticket bar codes words.txt -- a dictionary of 172,710 words small.txt -- a small 7 word dictionary ingwords.txt -- 12,557 words ending in ing Great Stuff |
Reusable CodeRandom Number Generatorrandom.java -- a random number generator EQUAL method real-number-equals-method.java -- used to see if two real numbers are equal to each other askQuestion method (graphios only) askQuestion.java -- use when asking for integer input -- data validatiom Linear Search method linear search -- used to search an array of integers for a target Binary Search method binary search -- used to search an array of integers for a target BUT the array MUST be sorted Bubble Sort method bubble sort -- used to sort an array of integers Quick Sort method quick sort -- used to sort an array of integers isNumeric(str) isNumeric(str) -- used to determine if a string is a number Circle Class Circle( ) -- a Circle class Rectangle Class Rectangle( ) -- a Rectangle class Dice Class Die( ) -- a Dice class |
Week | Content | Tasks | Extras |
---|---|---|---|
4 |
OOPs Object Oriented Programming
|
Assignment #2 - Chickens
Video 402: A running start to Chicken Assignment (30:27 mins) |
|
3 Wk 2 outcomes guide |
Control StatementsScanner's Secret Issue ( wrt to consuming the newline character left in the buffer )When using Scanner in Java to read input, you may encounter issues with newline characters being left in the input buffer, especially when switching between reading different types of data (e.g., reading an int followed by a double).
Here's an example: Scanner's Secret Problem Java Arrays
Below are flash cards with a lot of repetition to help you build and consolidate your understanding of Java arrays. Practice using the POWERPOINT file, running through these slides until you're knowledge of arrays is strong.
Array Flashcards ( pptx ) JavaFX Graphics - with Circle( )This program uses pre-built classes and illustrates how to ...
Solution: ( code ) ( RandomCircles.zip ) Reading & Writing Text Files
Video 30: if statements with AND ( && ) and OR ( || )(12:28 mins) Video 31: if statements & boolean comparisons with >=, <=, !=, ==, >, < (5:55 mins) Video 32: Reading from Files (5:33 mins) Video 33: Writing to Files (4 mins)
Lecture 2.1:
If, While, Boolean (47:01 mins)
Lecture 2.2:
For Loop (15:11 mins) |
What we did in class: Wed Sep 18 2024We began by reaching back to class 2 and introduced Java Arrays, using the Array flash card powerpoint file. This is a stack of flashcards which you should review over-and-over until you become strong in arrays. The Scanner class has a weird issue regarding reading ints and doubles. We discussed this issue and saw an example which illustrates what happens if you don't We began by discussing the syntax of DO WHILE. The DO WHILE loop is a good choice for validating input data. We did a Simon Says example where we used a Circle() class and a DO WHILE to generate random circles on the canvas. We then used a Rectangle() class to do the same thing. This example might help with A1-Arkanoid. Next, we discussed the SYNTAX of various control structures, like IF, WHILE, DO WHILE, and FOR. Next, we designed the UML for a RemoteToyHelicopter Lastly, we discussed the new worksheet(s). |
Remote Helicopter Class
|
2 Wk 2 outcomes guide |
Strings & NumbersJava Strings ( pptx ) ( code ) Java Numbers ( pptx ) Scope
In Java, the scope of a variable or object refers to the region of the program where the variable or object can be accessed or modified.
Example 1: ( code ) ( zip ) Example 2: ( code ) ( zip ) Casting
In Java, casting refers to the process of explicitly converting a value from one data type to another.
( code ) ( zip ) Java Arrays
Below are flash cards with a lot of repetition to help you build and consolidate your understanding of Java arrays. Practice using the POWERPOINT file, running through these slides until you're knowledge of arrays is strong.
Array Flashcards ( pptx ) Documentation Standards
Video 20:
Java Documentation (11:19 mins) Video 21: String Functions (17:02 mins) This video begins discussing special characters, e.g. \n, \", \\, and + Next various string methods are demonstrated, e.g. toUpperCase(), toLowerCase(), .length(), contains(), charAt(), indexOf(), substring()
Video 22: Number Functions (2.5 mins) Lecture 1.4: Data Types (34:21 mins) Lecture 1.5: Strings (12:22 mins) |
What we did in class: Tue Sep 10 & Wed Sep 11We began by discussing string methods as well as common methods used with numbers. Block level scope was discussed. We fixed two programs that had scope error issues. Next, we discussed casting and where and when it is commonly used. It was emphasized that a good understanding of Arrays are essential to this course. The Array Flashcards should be mastered. We outlined the importance of good documentation and the minimum standards required for documentation when submitting your program. Packages are a good way to organize like-minded java files. Today's worksheet centers on mastering format strings found in printf and String.format( ) |
|
1 |
Java - Review
Video 100: System.out.printf( "format", data ) (3:34 mins) Video 101: Java Documentation |
What we did in class this class:We began by reviewing data types, primitives versus objects, and methods using the tip calculator.A special discuss took place contrasting == and .equals(). Next, we did a simon says on the TipCalculator. The emphasis was on reviewing scanner and how to clear the line, as well as how to implement methods in Java. Next, we ran our first JavaFx program called, the happyface program. We discussed starting templates and ran a program which imports images as well as a program which demonstrates animation with a ball rolling across the canvas. The first assignment was discussed. This A1 involves using and documenting 3 java classes. The assignment features drawing a picture using the 3 given java classes. Assignment #1 - Make a Picture
|
|