Software | Off the Shelf (reusable java code) |
Extra |
---|---|---|
What is the JavaDoc tool and how do you use it? more about Javadocs How to Write Doc Comments for the Javadoc Tool Javadoc Embedder Embed Javadoc comments into your Java Source Files Javadoc comment generator Java Code Beautifier java code beautifier |
Scanner 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 ) |
Great Stuff |
Data Files words.txt -- a dictionary of 172,710 words small.txt -- a small 7 word dictionary ingwords.txt -- 12,557 words ending in ing |
Random Number Generator random.java -- a random number generator EQUAL method real-number-equals-method.java -- used to see if two real numbers are equal to each other 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 |
1-on-1 Zoom Extra Help Session(s) Note: the chat will end early if no one appears in the first 10 minutes.
|
Class | Topics | Tasks | Extra | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
14 |
2-Hour Practice Final College Exam
(headphones, texting, emailing to other people are NOT permitted)
|
||||||||||||||
13 |
Data Validation
Video 130: What is an Algorithm? (5:27 mins) Video 131: Floating Point Numbers (9:15 mins) |
What we covered in class today:Today, we learned about algorithms. How they are made and tested. What happens if poor testing is allowed to happen. |
Practice Quiz#3 - more ArraysBe sure to adequately document your program.specifications Video 132: how-to-video (7:04 mins) Help? If you can't do this problem in 30 minutes, you need assistance. Assistance on this and any worksheets are available at the fireside chats. |
||||||||||||
12 |
Reading & Writing Text FilesExample 1: Reading a Dictionary called,
words.txt
readfiles.zip
Example 2: Write a Java program to visit every word in the dictionary and display the words which contain the string Example 3: Write a Java program which displays a random word from the dictionary.
This program requires the
words.txt dictionary file.
solution Example 4: Writing a File This program creates and writes one line to a new text file. Video 120: Reading from Files (5:33 mins) Video 140: Writing to Files (4 mins) |
What we did in class today:Today, we were introduced to reading files in Java. We practiced reading the dictionary with two Simon Says exercises. Next we watched a video on how to construct a guessing game. Finally today's worksheet asked us to find all of the palindromes in the English language. |
Quiz#2Be sure to adequately document your program.specifications (download this Q2.zip ) (when you're finished, ZIP up your quiz, called it, Q2-finished.zip and email it to dave.slemon@mohawkcollege.ca) A NanoSecond StopWatch
import java.util.Locale; //for nanoTime |
||||||||||||
11 |
Random NumbersExample: Random Numbers Program Try each of these programs, before looking at the code.Example 1: Write a main pgm to populate a 20 element integer array, called A, with random numbers between 0 - 25 inclusive.
code Example 2: Write a main pgm to add up the sum of all the numbers found in a random double array, called weights, of 10 elements. Make the numbers between 1 - 25 inclusive. code Example 3: Write a main pgm and two static methods called, smallest and frequency, which run through an array, called data, of 100 integers values. Reports back the smallest integer found. Make the numbers between 0 - 99 inclusive. In addition, report back as to how many times the smallest element occurred in the 100 element integer array called data. code
Video 110: Guessing Game (12:35 mins) |
What we covered in class today:Today's Worksheets
|
More about Random Numbers in Java |
||||||||||||
10 |
Sparse 2-D ArraysA matrix is sparse if many of its coefficients are zero. Many large programs in nature can been represented by sparse arrays. sparsity = Example1: Walking through 2d Array
Example2: Triplet Example Video 101: 2-D Arrays (8:50 mins)
Video 102: Sparse Matrix Algorithm -- Triplet Algorithm (4:40 mins) |
What we covered in class today:Today, we learned how to create 2-D arrays. The sparse array takes up lots of space, so we learned how to compress such arrays with the triplex algorithm. |
![]() ![]() |
||||||||||||
9 |
Using Arrays
Become an expert at arrays by doing all 36 questions. Recommended: do a question, then check the answer to that question, etc.
Video 90: About the Voting Machine (12:30 mins) |
What we did in class today:Today we discussed the requirements of the voting machine. We then coded an array example, involving finding your youngest friend and displaying their name and age.Assignment #2 - Voting Machine
The Voting Machine Specifications
( rubric )
( data structures )
|
|||||||||||||
8 |
HSAFX - Graphics
a simple graphics pgm ( product-shot ) ( zip ) displaying a car image ( product-shot ) ( zip ) |
What we did in class today:Today, downloaded and explored the HSAFX java graphics package. |
|||||||||||||
7 |
Loop Practice & Tracing
Loop Exercise ( pptx ) Exercise 1:Tracing Sheet 1 ( solution ) Exercise 2:Tracing Sheet 2 ( solution ) Video 70: Nested For Loops (3:53 mins) |
What we did in class today:Today, we reviewed and practiced using, FOR loops. |
Practice Quiz#2Practice Quiz #2 ( main ) ( solution ) ( The real quiz #2 will occur in the last 30 minutes of class #8) |
||||||||||||
6 |
For Loops & Built-In ArraysArray Questions ( pptx ) |
What we did in class today:Today, we studied the for loop and built-in arrays. |
Senior Programmers ONLY!
( also demonstrates how to iterate over an array ) |
||||||||||||
5 |
While Loops & Switch
While Loops ( pptx ) Example 1: While Loops with Sentinels (break & continue) code Video 50: While loops (6:32 mins) Video 51: switch statement - a more complicated type of IF statement (8:45 mins) |
What we did in class today:Today, we studied the while loop, do-while loop, and switch statement.Today's WorksheetsAssignment #1 - The Personal ATM |
Assignment #1 - TrianglesSenior Programmers have a choice to do the Triangles assignment or the Banking ATM assignment.A very good triangle checker where you can enter 3 ordered pairs.
triangle calculator |
||||||||||||
4 |
IF Statements
The IF statement ( pptx ) Video 40: if statements with AND ( && ) and OR ( || )(12:28 mins) Video 41: if statements & boolean comparisons with >=, <=, !=, ==, >, < (5:55 mins) |
What we did in class today:Today, we studied the IF statement along with the AND and OR boolean operators. For a more longer set of cases we introduced the switch statement. |
|||||||||||||
3 |
Static Methods
Static Methods ( pptx )
Video 30: User-defined Methods (10 mins) Video 31: Returning Information from a Method (7:15 mins) |
What we did in class today:Today, we wrote user-defined string and numeric methods. These methods all accept input parameters and return a value. |
Practice Quiz#1(based on W0 - W6)Quiz #1 ( docs main ) ( The real quiz #1 will occur in the last 30 minutes of class #5) Useful LinksSenior Programmers ONLY!
|
||||||||||||
2 |
Strings & NumbersVideo 20:
Getting User Input (7.9 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) |
What we did in class today:We introduced several string functions including concatenation, accessing characters in a string, lower and upper case, and thelen( )of a string function. We also introduced float( ), int( ). The mod operator also called the remainder operator was discussed, %. Today's Worksheets
It's ok to peek at the answers if you need to. Be sure to MATCH the sample session EXACTLY. Don't put any creativity into these worksheets, just write code which matches the sample session. |
Useful Links
Java Scanner Class |
||||||||||||
1 |
Variables, Data types & Expressions
Video 10:
About Java
(8:37 mins)
Video 11:
Drawing a Shape
(4.8 mins)
Video 12:
Variables
(12.4 mins) |
What we covered in class today:Today we are running our first Java program. The first worksheet is about choosing a figure and writing a program to create that figure on the video screen.Today's WorksheetsComplete each worksheet and demonstrate and/or hand the worksheet into your teacher. It's ok to peek at the answers if you need to. Be sure to MATCH the sample session EXACTLY. Don't put any creativity into these worksheets, just write code which matches the sample session. |