IB Comp Sci 2011 - Daily Notes SL Year

Tue 9 Feb 2010

Dating Project with OOP

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.

Thu 4 Feb 2010   

Introduction to Object Oriented Programming  

Homework : finish #1-4 with the Parking program

HL students : in the IB textbook, read about Inheritance, Encapsulation, Polymorphism

Wed 3 Feb 2010

 * 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).

Mon 1 Feb 2010

Discussed students' examples of sub-optimal automation.

No homework today.

Fri 29 Jan 2010

Class cancelled for early dismissal.

Thu 28 Jan 2010

Automation + Cleverness = Artificial Intelligence

    Automated Packing 

Homework :  #7 (above) - be sure to WRITE DOWN your answer,
                      whether it is on paper or in a computer document

Tue 26 Jan 2010

More Automation with Packing Boxes

    http://ibcomp.fis.edu/simulation/loading.html

Homework:  Do problem #4 - the HELP(99) function

Fri 22 Jan 2010

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) ...

Wed 20 Jan 2010

  Fill in the Blanks Practice

  Homework :  Finish #5-7 in  ArraysPractice1 

Tue 19 Jan 2010

   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). 

Mon 18 Jan 2010

   Songs.java with answers an ArraysPrac1 #1-4 

   Do these problems: Yesterday - finish this as homework

Thu 14 Jan 2010

The results on the Top-ten Test were poor, so we need to do more practice with programming arrays.

    ArraysPractice1  

Finish #1-#4 before Monday (or as much as you can in the time available).
Practice, practice, practice.

Wed 13 Jan 2010

Top-ten Test  (with answers)            

Mon 11 Jan 2010  

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.

Wed 16 Dec 2009

Top Ten Practice Program

Mon 14 Dec 2009

Inserting - some programming practice

Fri 11 Dec 2009

Sorting Quiz

Homework :  Find out how an INSERTION SORT works.
                  Be prepared to EXPLAIN it in class on Monday.

Thu 10 Dec 2009

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

Tue 8 Dec 2009

Finish #6 on the Simple Sorting Practice

Program for Timing Sorts

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.

 

Mon 7 Dec 2009

Simple Sorting Practice

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.

Fri 4 Dec 2009

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

Wed 2 Dec 2009

Payroll Database in Parallel Arrays

Tue 1 Dec 2009

Finish #6 in    Arrays = Lists   
It must store the FOODS and PRICES in a text-file and read that data when it runs. 

Mon 30 Nov 2009

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.

   Arrays = Lists    

Mon 23 Nov 2009

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.

Fri 20 Nov 2009

Data Analysis - the CIA Factbook

Wed 18 Nov 2009

Eclipse IDE

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

Tue 17 Nov 2009

Files Test

Mon 16 Nov 2009

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)

  1. Count the number of names in a file containing a list of names.
  2. Search for a specific name in a file containing a list of names,
    and print "found" or "not found" as appropriate.
  3. readLine a number from a file and convert it to a double using:
        double num = Double.parseDouble(data);
  4. Add up all the numbers in a file containing a list of numbers.
  5. Count how many prices in a file are larger than 10.00 .
  6. In an accout file that contains names and passwords, input a name and password
    and check in the file to see whether these match what's in the file.
  7. In a file containing names and ages of children, find a specific name
    and print the corresponding age.
  8. In a file containing names and ages of children, print the names of all
    the children who are 10 years old.
  9. In a file containing names and ages of children, calculate the average
    of all the ages by: (1) counting all the children; (2) adding up all the ages;
    (3) dividing to find the average.
  10. Given a check-in file and a check-out file, containing names and times, find a name in both files and print the check-out and check-in times.

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
 ....

Thu 12 Nov 2009

Practice problems in Simple Checkouts

Test on Tuesday 17 Nov about FILES - partly with the computer, partly written.

Wed 11 Nov 2009

Simple Checkouts

Tue 10 Nov 2009

Early Checkouts

We will discuss the Analysis and Design of this system.

Thu 5 Nov 2009

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.

Wed 4 Nov 2009

Money Counter - statistics for a file of numbers

Tue 3 Nov 2009

Using a LOOP to read a longer text-file

Fri 30 Oct 2009

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.

Thu 29 Oct 2009

More about substitution in the Adlibs program.

Wed 28 Oct 2009

** 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.

Fri 23 Oct 2009

Turn in your program together with a report, as described here:

    Finishing your Program

Tue 20 Oct 2009

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.

Mon 19 Oct 2009

Remember that your program is due on Friday 23 Oct.

Here's one more clever programming technique:

    Choice Boxes (Lists)

Fri 16 Oct 2009

== Today's BIG Idea ==

Computer Science  concerns itself with SYNCHRONIZING
automated machine actions
with users needs and tasks.

In 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

Wed 14 Oct 2009

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. 

Thur 1 Oct 2009

Fast Food Cash Register

Mon 28 Sep - Tue 29 Sep, 2009

Practice :    Times Case Study

Reading :   If..then.. decisions 

Fri 25 Sep 2009

Quiz

Handling Times - a case-study of a problem that requires String manipulation and validation, as well as conversions between String and integer variables.

    Times Case Study

Wed 23 Sep 2009

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:

Mon 21 Sep 2009

Local logins - log in as : ib11

Using www.getdropbox.com

Making a password program in Java.

Thu 17 Sep 2009

Homework:  In BluePelicanJava do the questions 1-12 in section 3-3.
Turn in answers ON PAPER on Monday 21 Sep.

Wed 16 Sep 2009

Turn in your WORKING program by sending an e-mail to:

    Dave_Mulkey@fis.edu

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.

Tue 15 Sep 2009

Finish up whatever math problems you have started.
Tomorrow, Wed 16 Sep, turn in a working program
at the beginning of class.

Fri 11 Sep 2009

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

Thu 10 Sep 2009

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#x2200

Wed 9 Sep 2009

Longer math problems - use lots of variables and a List box for output.

Mon 7 Sep 2009

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) ;

Fri 28 Aug 2009

Math problems with Input/Output in GUI mode

   GUI with EasyApp    Problems

Wed 26 Aug 2009

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   

Tue 25 Aug 2009

More Math Errors   : Bad_Math

Homework :  Read p. 57-62 in David Schmidt's Book, Chapt 3

Mon 24 Aug 2009

More Calculations and Errors

Homework:  Why do calculation errors occur? http://ibcomp.fis.edu/numbers/numbers.html   

Thu 20 Aug 2009

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.

Wed 19 Aug 2009

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