Homework : Read the Dating Project
document.
Fill in the blanks in the prototype program and get the program working.
HL Students - Change the Dating prototype to use a Linked-List instead of an array.
Introduction to Object Oriented Programming
Homework : finish #1-4 with the Parking program
HL students : in the IB textbook, read about Inheritance, Encapsulation, Polymorphism
* SNOW DAY *
We will be starting to
learn about Object Oriented Programming (OOP).
To prepare for tomorrow's
lesson, read Chapter 1 in Schmidt's book:
http://people.cis.ksu.edu/~schmidt/PPJv12pdf/ch1V9.pdf
As you read, write down any words that you do not
understand.
Bring your list of words to the next class meeting and
turn it in
(this is homework).
Discussed students' examples of sub-optimal automation.
No homework today.
Class cancelled for early dismissal.
Automation + Cleverness = Artificial Intelligence
Homework : #7 (above) - be sure to WRITE DOWN your
answer,
whether it is on paper or in a computer document
More Automation with Packing Boxes
http://ibcomp.fis.edu/simulation/loading.html
Homework: Do problem #4 - the HELP(99) function
Automation - Packing Boxes
http://ibcomp.fis.edu/simulation/loading.html
Homework :
(1) Run the program and
find out what it does.
You do not need
to fix it or do any of the exercises.
(2) Write an explanation of HOW you
tried
to solve the packing
problem for the 10 numbers
-
what was your brain looking
at?
... HL students - do the same assignment, also using arrays (not linked-lists) ...
Homework : Finish #5-7 in ArraysPractice1
Yesterday (with answers)
Download Songs.txt
Do problems 5-7 in ArraysPractice1 by adding new methods
to your solution
(or the teacher's solution) for
Songs.java (above).
Songs.java with answers an ArraysPrac1 #1-4
Do these problems: Yesterday - finish this as homework
The results on the Top-ten Test were poor, so we need to do more practice with programming arrays.
Finish #1-#4 before Monday (or as much as you can in the time
available).
Practice, practice, practice.
Top-ten Test (with answers)
Due to the cancelled class on Friday 18 Dec, the test is being postponed until Wed 13 Jan (rather than Tuesday).
In case you are having problems with the Top Ten Program, here are some partial solutions.
Suggested Solutions for Top Ten Scores
You will still need to insert them correctly into the MathGame and make them work, as well as finishing the insertion method. An make sure that you understand how the methods work - otherwise they will not be very useful for you in the test.
It would be wise to ask questions and get help during class on Tuesday if you are still having problems.
Inserting - some programming practice
Sorting Quiz
Homework : Find out how an INSERTION SORT
works.
Be prepared to EXPLAIN it in class on Monday.
Today's quiz has been postponed,
because
sorting takes longer than we expected.
---> QUIZ on Friday 11 Dec - 30 minute quiz about arrays and sorting
Today's sorting practice : Basketball Roster
HL --> Do the Bucket Sort instead of the Basketball Roster
Finish #6 on the Simple Sorting Practice
Homework : Better Sorting Efficiency
-
Write a FASTER sorting algorithm (method)
-
one that is faster than the
SimpleSort.
Try BubbleSort or SelectionSort -
maybe you want to get some help
from:
http://www.solidware.com/sort/
Test your sort - check the times to
see
that yours is faster.
Homework : Finish #5 in the Simple Sorting Practice
(above)
Here are some more notes about sorting:
http://ibcomp.fis.edu/sorting/introNotes.html
You may find
these notes helpful.
Sorting
- do this assignment during class.
Try to finish it at home.
If you need more explanations about sorting, read this:
Programming Principles in Java by David
Schmidt
Chapter 8 , section 8.14.1 -
Sorting
Payroll Database in Parallel Arrays
Finish #6 in Arrays =
Lists
It must store the FOODS
and PRICES in a text-file and read that data when it runs.
We need to do quite a lot of processing to produce useful results from the CIA Factbook files. Some of this is much easier if we use arrays for temporary storage. So we will take a detour from the factbook for a few days and learn to use arrays.
Java programs for processing CIA Factbook text-files
Finish the practice at the end of the page (above) and bring the working program to class on Monday 30 Nov.
Data Analysis - the CIA Factbook
Web as Database
The World-Wide-Web can be used as a huge database - not just providing access, but actually storing the data for us.
Get answers to the following questions (take notes and prepare for a discussion):
Find some data tables in
Wikipedia.
- Copy a data table into an Excel
spreadsheet
- Convert the data so that it fits into a
text-file
- Outline how a program could
read this file
Which country is the "best" in the world?
- Make a statement (could be
your opinion or someone else's)
- Find data that supports
your statement (not just someone's opinion)
- Keep track of the
source of your data
- Find a
graphical presentation of some data that supports your
statement
Find out what each of the following terms mean:
- Data
mining
- Data scraping
- Data
warehouse
- Data-driven web-page
- Data
protection
Tomorrow's test will have several written questions where you must write Java methods on paper, plus a programming problem to be done using the computer. Make sure you know (e.g. memorize) how to do all of the following.
(Solutions here, but try to write some of them yourself first)
During the test, you will nott be required to WRITE data into a file -
you only need to write methods that READ data from a file and process
it.
Sample data files:
| Names.txt | Prices.txt | Accounts.txt | Students.txt |
| Albert Bobby Carla Doug Ellen Fred .... |
5.50 13.50 10.00 9.95 12.00 1.25 .... |
Abraham 4br4h4m Mulkey secret123 Zoro mag1c .... |
Billy Bob 8 Bobby Bill 12 Bobbly Wobbly 16 .... |
Practice problems in Simple Checkouts
Test on Tuesday 17 Nov about FILES - partly with the computer, partly written.
Early Checkouts
We will discuss the Analysis and Design of this system.
Homework
Download this program and do the tasks
listed at the top : LeaveEarly.java
Extra Credit : Find out how to get the correct current time from the system clock.
Money Counter - statistics for a file of numbers
Using a LOOP to read a longer text-file
Using external storage (text-files).
Homework (due Tuesday)
Make a program with at least 4 words to input, and at least 4 text-phrases for the story template. Then write at least 4 text-files containing story templates. But remember to make all the stories follow the same pattern, so that your program does not need to sometimes input nouns, sometimes verbs, etc.
Next Week
On Tuesday we will practice more with variables and text-files. Expect a short quiz on Wednesday and a longer quiz (small test) on Thursday.
More about substitution in the Adlibs program.
** SUBSTITUTION **
Substitution is a critical concept in Computer Science. Look at these web-pages:
Crazy Libs Night of the Living Dead
Homework
Write an Adlib program, similar to the
web-pages above.
It should INPUT words from TextFields (not
Input commands)
and produce its output in the EasyApp GUI window (e.g.
in a List box),
not using System.out.println.
Turn in your program together with a report, as described here:
Continue working on your Fast-Food Cash-Register.
You must turn in a working program on Fri 23 Oct.
You
will not have time to "finish up" on Friday,
because you will be writing a
summary report
about what you did, why and how. That
only takes
about a half hour, so you can do it during class -
no need to
start ahead of time.
Remember that your program is due on Friday 23 Oct.
Here's one more clever programming technique:
== Today's BIG Idea ==
Computer Science
concerns itself with SYNCHRONIZINGIn the past, we wanted to AUTOMATE processes
to REMOVE the user from
the process and replace user's work.
That's still a good goal, but
interactivity is now accepted.
When working on the cash-register program, remember to think about
USER
ACTIONS as well as AUTOMATION in your program.
This program is definitely
interactive.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
== Today's Notes ==
Look at the Clever Techniques for the Fast-Food-Cash-Register.
Try to add something clever to your program.
You must turn in a working program on Fri 23 Oct.
You will also have a quick quiz each day next week, plus a
couple more good ideas.
You should be mastering the
use of String methods.
You might find these
notes helpful: String
Notes
We will continue on theFast Food Cash Register for another week or two.
Today, choose one of the "Big Improvements" and try to add this to your program - perhaps the [BIG BUTTONS] for specific food items. If you wish, you may start with this program as the basis.
Practice : Times Case Study
Reading : If..then.. decisions
Handling Times - a case-study of a problem that requires String manipulation and validation, as well as conversions between String and integer variables.
5 minute quiz
Validating Strings - lecture
Homework - as a group the class should write down VALIDATION RULES for each of the following types of String information:
Local logins - log in as : ib11
Using www.getdropbox.com
Making a password program in Java.
Homework: In BluePelicanJava do the questions 1-12 in
section 3-3.
Turn in answers ON PAPER on Monday 21 Sep.
Turn in your WORKING program by sending an e-mail to:
You should send the .java file as an ATTACHMENT.
Today : Strings
Sample program : Quiz (needs EasyApp in the same folder)
In BluePelicanJava, read 3-1 to 3-2 about Strings. Bring questions and prepare to discuss 3-3.
Finish up whatever math problems you have started.
Tomorrow, Wed
16 Sep, turn in a working program
at the beginning
of class.
![]()
Look at this sample code - copy it into your LongProblems program.
Notes about graphics commands :
http://java.sun.com/javase/6/docs/api/java/awt/Graphics.html
You may need to insert special "math symbols" into your output, like this:
The "squared" symbol and the "square-root" symbol can be written like this:
info.add("x \u00B2 =
2");
info.add(" x = \u221A
2");
info.add("\u221A 2 = "
+ Math.sqrt(2));
"\u221a" is called an escape character sequence.
It creates a Unicode symbol.
The number
221A is written in hexadecimal (base 16) -
more on this later.
You can see lots of mathematical Unicode symbols in tables like this:
http://www.ssec.wisc.edu/~tomw/java/unicode.html#x2200Longer math problems - use lots of variables and a List box for output.
More practice with GUI and Math problems.
Homework: Write a program to calculate the Quadratic
Formula.
It will probably contain these commands (plus lots
more):
double x1 = (-b + Math.sqrt(b*b-4*a*c)) / (2*a)
;
double x1 = (-b - Math.sqrt(b*b-4*a*c)) / (2*a) ;
Math problems with Input/Output in GUI mode
Start using DrJava - V:\Mulkey Dave\drjava.exe
Copy it to d: and run it from there, rather than running from the
server.
Using variables in math problems
Sample program: http://ibcomp.fis.edu/numbers/circles.html
More Math Errors : Bad_Math
Homework : Read p. 57-62 in David Schmidt's Book, Chapt 3
More Calculations and Errors
Homework: Why do calculation errors occur? http://ibcomp.fis.edu/numbers/numbers.html
Calculations
Back in the 1940's, "computers" were used for calculations. Back then, the only alternative for doing long calculations was to use a paper and pencil - both slow and unreliable. At the beginning of the "computer age", all the excitement was just about doing calculations quickly.
Modern computers are doing calculations at the rate of BILLIONS of calculations per second. You probably don't really need to do billions of calculations - a really big homework assignment might have 100 math problems with several calculations per problem. So you might need to do 1000 calculations per day, but probably not more than that.
So what is your PC actually doing with all that unused capacity? Nothing. It is sitting there, waiting for you to move the mouse or type on the keyboard.
More Than Meets the Eye
But the computer actually does a lot more than you see. If you ask your computer to play an MP3 file (a song), it must reproduce 44000 tones per second. Each tone is represented by a number between 0 and 65535. That would be pretty easy if those tones were just streamed (recorded and played back in order), but MP3 files are compressed to save space. Before playing the sounds, they must be decompressed. That means there are at least 44000 calculations per second - actually it's a lot more than that, because the compression/decompression (CODEC) algorithm involves lots of calculations, maybe 10 calculations for each of the 44000 tones - meaning 440,000 calculations per second. Still, that's only a tiny fraction of a billion per second. No problem!
First Programming Exercise
Use Processing to do the following assignment : Calculations
Finish as much as you can during class - the rest is homework. Be prepared for a discussion during class tomorrow.
Introduction
IB Computer Science is a 2-year course. The first year deals mainly with programming in Java. The second year covers hardware and system concepts. During the second year students will create a large programming project to solve a real-world problem (the Internal Assessment dossier). At the end of the second year, students take two written examinations, approximately 2 hours each. The dossier and exams each contribute 1/3 of the final IB mark.
Students learn to write Java programs efficiently and quickly, enabling them to complete the Internal Assessment project (dossier) successfully. They also learn to write clear explanations about computer systems, hardware and software, using correct technical vocabulary, enabling them to successfully answer written exam questions.
The teacher will make every effort to present new concepts clearly and completely, as well as allowing ample class time for practice and discussion. Students must make an equally conscientious effort to learn, understand and remember the topics. Students are expected to learn as much as possible at all times and to:
Normally students will have a working PC at home, where they can write and debug Java programs. In the unusual circumstance that their PC is broken, students need to plan on spending extra time at school, outside class time, to complete programming assignments. Some class time is devoted to writing programs, but this is not sufficient to completely finish assignments.
Class CD (at FIS only) 2-year Teaching Plan + Vocabulary
Good Habits General Comments about How to Study