by Dave_Mulkey@fis.edu , Frankfurt International School , Germany
IA
Project Resources IB
Comp Sci Quick Start
|
Have a look at Haiku, especially project deadlines for next school year.
Continue working on your prototype.
Ask questions and get help if you need it.
Prototype Project
AFTER THE EXAMS each student will create a PROTOTYPE
project.
The goal of the prototype is NOT to be a start to your real project,
but rather to get used to the process required, which is more than
just typing a Java program. So it isn't absolutely necessary that
your choice for a problem for the prototype is your final choice
for the real project. You will spend about 1 week on this task,
so if you throw it away you won't lose much work. For this purpose,
it's best to choose a straightforward (or easy) problem that you
already understand well .... maybe a game of some sort.
Use
this template which will help you do the right thing
in terms of creating and maintaining DOCUMENTATION parallel
to your programming work.
This prototype is due on 19 August.
It must include:
- DOCUMENTATION in each section of the template
- a working Java program that solves at least
some of the identified problem
- this will be submitted electronically - not printed on paper
We will work on this during class until the end of the year
(that is Tuesday 19 June). You should ASK QUESTIONS
and GET HELP if you need it. Make progress NOW -
don't assume that you can do it all in August. That is
unrealistic.
The prototype may be created with any tool(s) you choose -
NetBeans is recommended, but BlueJ is certainly adequate.
Final Exam
https://dl.dropboxusercontent.com/u/239179/ibcomp/yearend2013/FinalExam2013.pdf
If you missed questions on the exam, especially programming questions,
you may wish to review them this summer.
NetBeans
Here is a good introductory video for NetBeans -
http://www.youtube.com/watch?v=LFr06ZKIpSM
Pilot
Project
We originally planned to spend a week on the pilot project
and finish it before the end of the year. But due to various
class cancellations, that isn't going to fit into this year.
So we will plan on starting the pilot project from Friday 14 June
until Wed 19 June, and then finishing it the first week of
school in August. Plan on working on this in class for
the next few class meetings.
The class will meet in room 322 during period 2 today.
The teacher will distribute a DVD containing the NetBeans Java IDE and various study materials for the summer.
We will review the Final Exam results.
Homework :
If you use a personal laptop, bring it to class tomorrow with NetBeans
installed.
You can either download a copy from https://netbeans.org/downloads/
or install it from the DVD.
Sample
Exam from 2011 - This year's final exam will be similar
to this one in structure, but do NOT assume that it will cover exactly
the same topics - we studied different things in 2011. This
example
just demonstrates the layout of the exam.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Here are topics from this year - you should definitely review these:
Computer Systems
- Textbook Chapter 1
- Computer
Systems Notes
Numbers in Computers
- Intro
to Binary
- Textbook Chapter 3
- Floating
Point and errors
- Binary
Storage Examples
- Numbers
Review Questions
Logic
- Reading
about If command
- Password
Check Program
- Type of Errors
Strings
- String
Methods
- String
Examples
- Overdue
Books
Arrays
- Counselor
Appointments Program
- Searching
an Array Program
- Parallel
Arrays Program
OOP
- Notes sections
2.1-2.8 on this page
- Student
List Program
- Lockers Array Program Lockers2.zip
- Lockers
Automation Notes
Vectors
- Vector Lockers Vectors2.zip
Information and Data
- Information vs Data
-
newest version of the Pisa program
- Text Files CIA
Index ver 2
Operating Systems
- Textbook Chapter 10
- HowStuffWorks
"How Operating Systems Work" (12 pages)
- list
of OS questions
Searching and Matching
- How
does Google search work?
- Methods
for Comparing Strings
- String
Comparisons Notes
- the
Extra Spaces problem
- Search
Program
- Sequential Search, Dictionary Search, Binary Search
Sorting
- Algorithm
Efficiency
- Bubble sort, Insertion sort, Selection sort
- Several
Sorts with Java Source
- Sorting
Efficiency Test Program
Testing - test-cases, automated testing
HL Students - Compression and Encryption- Embedded Processors - Automation - 2D Arrays - Kings Download this Java class - Linked-Lists - Stacks and Queues p 245-248 in Textbook |
~~~~~~~~~~~~~~~~
Java Programming
- Declaring variables - int float double String char
- String methods substring
charAt .length() equals
equalsIgnoreCase
- if.. commands &&
||
- loops for while
- methods public void return
- declaring arrays
Vectors iterator
- OOP new class
object constructor
- files BufferedReader
FileReader .readLine
- (cast) (int) (double)
~~~~~~~~~~~~~~
Important Words and Concepts
Variables int float
double String
Binary hexadecimal error
truncation concatenation
ASCII UNICODE
CPU processor memory RAM
Bit Byte Kilobyte Megabyte
Gigabyte Terabyte
Arrays lists parallel arrays
length index
Vectors iterator next
Exception ArrayIndexOutOfBounds NullPointer
OOP object class .dot
notation constructor
OS multi-tasking memory
processor
MVC Model-View-Control
GUI controls
int float quiz https://dl.dropboxusercontent.com/u/239179/ibcomp/dailyQuizzes/quiz10oct.html
num errors quiz https://dl.dropboxusercontent.com/u/239179/ibcomp/dailyQuizzes/quiz12oct.html
String quiz https://dl.dropboxusercontent.com/u/239179/ibcomp/dailyQuizzes/quiz18oct.html
if quiz https://dl.dropboxusercontent.com/u/239179/ibcomp/dailyQuizzes/quiz30oct.html
Nums Test SL https://dl.dropboxusercontent.com/u/239179/ibcomp/numbers/numstestSL.html
Nums Test HL https://dl.dropboxusercontent.com/u/239179/ibcomp/numbers/numstestHL.html
Assembly Language Test https://dl.dropboxusercontent.com/u/239179/ibcomp/pep8/peptest.doc
Simple Array Test https://dl.dropboxusercontent.com/u/239179/ibcomp/arrays/simpleArrayTest.html
Array of Objects Quiz https://dl.dropboxusercontent.com/u/239179/ibcomp/GUI/Quiz26Jan.html
Vector Quiz https://dl.dropboxusercontent.com/u/239179/ibcomp/GUI/vectorquiz2.html
Worst 10 Vector Quiz https://dl.dropboxusercontent.com/u/239179/ibcomp/GUI/Worst10quiz.docx
Vectors Test https://dl.dropboxusercontent.com/u/239179/ibcomp/CIAFactbook/vectorsTestHL.htm
OS Quiz https://dl.dropboxusercontent.com/u/239179/ibcomp/OS/osquizmar2013.html
Searching Test https://dl.dropboxusercontent.com/u/239179/ibcomp/searching/searchTest.pdf
Sorting Test https://dl.dropboxusercontent.com/u/239179/ibcomp/sorting/sortingTest.html
=========================================
Prototype Project
AFTER THE EXAMS each student will create a PROTOTYPE
project.
Today, make sure that you have CHOSEN A PROBLEM (topic) and
the teacher has approved it. If you are unsure, discuss it with
the teacher today.
The goal of the prototype is NOT to be a start to your real project,
but rather get used to the process required, which is more than
just typing a Java program. So it isn't absolutely necessary that
your choice for a problem for the prototype is your final choice
for the real project. You will spend about 1 week on this task,
so if you throw it away you won't lose much work. For this purpose,
it's best to choose a straightforward (or easy) problem that you
already understand well .... maybe a game of some sort.
Use
this template which will help you do the right thing
in terms of creating and maintaining DOCUMENTATION parallel
to your programming work.
=======================================
Final Exam
Next week we will spend 2 days reviewing for the final exam.
If you wish to start reviewing earlier, it's quite easy.
Next week, bring questions to class about things you would
like to have explained again.
Starting
the Project - Suggested Topics
Your project is a much longer process than "just writing a program".
We will discuss these documents:
Here are some interesting web-links about the Travelling Salesman Problem:
TSP Applet
TSP in Wired
TSP
Movie
Europe Simulation
===========================================
Your project is a much longer process than "just writing a program".
We will discuss these documents:
Starting Simple Big Tic Tac Toe Prototype
(1) Test on sorting algorithms
(2) Homework - read briefly through this sample
Internal Assessment Project
Bring questions for discussion during our next class meeting.
Investigate and explain the efficiency of various sorting algorithms.
Use
this program.
Sample sorting algorithms - some don't work: Click here to download
Test Announcement - Test on Friday 17 about SORTINGPractice programming sorting algorithms -
Bubble Sort, Insertion Sort and Selection Sort
Homework
We will continue discussing the Traveling Salesman Problem,
and look at the partial solutions programmed by
some of the students.
Demonstrations
- Bubble
Sort
- Several Sorts with Java Source
Homework
In the Computer Science Illuminated textbook, read p. 218-226
We will discuss yesterday's investigation,
then start programming a binary search.
Search Efficiency Investigation
We have discussed the basic concepts of 3 search algorithms:
- sequential search
- binary search
- dictionary search
Today we will discuss how to PROGRAM the dictionary
search algorithm.
The basic concept is outlined in the following pseudocode:
Homework -
Write a Java method that performs the Dictionary Search algorithm,
searching for a word in the WORDS LIST used in previous programs.
Your method should also count the number of iterations
(steps) required
until the method stops searching. Then compare this methods speed
with a normal sequential search - make a table of 20 representative
words and record the number of iterations of sequential and dictionary
searches for each word.
Bring your results to class on Thursday 2 May, which is
our next
class meeting.
Read about the TSP at the end of these notes:http://ibcomp.fis.edu/files/BigO/bigo.htm
This is a very famous Computer Science problem.
So you can search in Google and find lots more information if you wish,
probably including some simulator programs that "solve" the problem.
Homework : Start with the TSP program that you received on paper.
Add any code that would be useful in solving the TSP problem, for example:
(1) find the 5 smallest numbers in the list miles array
(2) print out all the possible trips
(3) Given a trip in 5 steps ( AB, BD, CE, DC, DA )
check that each city appears exactly twice
(4) Given a trip like : ABDECA,
add up the total miles in the trip.
Work on this for an hour or two. You won't completely solve TSP
(but if you do, you'll be famous very quickly). Just write some
pieces of program that might be useful in a TSP program.
After finishing your test, read the following (also available on paper):
http://ibcomp.fis.edu/files/BigO/bigo.htm
As you read, you should TAKE NOTES about anything that is unclear.
Plan on asking questions in class tomorrow.
Today we will learn how to INSERT a new word into an Array in alphabetical order.
Remember - Test on Wednesday 24 Apr
Covering all the lessons from the past 2 weeks (Apr 9 onward)
Here is a solution to the homework from yesterday -
using an ARRAY for searching in a list of words:
http://dl.dropboxusercontent.com/u/239179/ibcomp/searching/search3.zip
Today's lecture -
Searching (in both a Vector and an Array) for many matching words,
returning the matches as a list (either a Vector or an Array as
appropriate).
Here is an ALMOST solution to the
Extra Spaces problem.
It contains exactly one mistake.
You must study the "removeSpaces()" method until:
Searching in Lists
We must study the problem of searching in lists.
There are several related standard tasks:
Homework
#1 - in the WordList program, find the method that does problem #1 above.
#2 - Make a new version of the WordList program,
but it should use an ARRAY to do #2
above.
Download this project archive - StringCompareTests.zip
Write a program that inputs a String, like:
" okay dude "
and the program removes any extra spaces, producing:
"okay dude"
Try to start by writing the TEST CASES first,
before writing the program. Code the test
cases like you saw in the previous program,
so the testing is automated.
The Levenshtein Distance between two Strings is based on the minimum number of edits required to change one String into the other. Wikipedia has a straightforward explanation.
We will try to write a method that calculates this value.
We will discuss students' ideas about how to check whether
two Strings are almost
equal.
We will do some experiments with a Java program
to implement some search algorithms.
Download this sample program : SearchExamples.zip
Continue investegating : How
does Google search work?
Read the notes and do some experiments with Google.
Answer the QUESTIONS in the notes (as many as you can)
and then do the Text Experiments. You may find it
useful
to work with a partner and help each other.
Bring questions for discussion to class on Wednesday.
We will make a list of examples
where we see the results -
we will base our examples on this list
of questions.
of the important ideas from our reading in the text-book.
The main ideas are summarized in the Ch
10 PowerPoint presentation.
We will have a short test (30 minutes) on Thursday 21 March,
about the vocabulary and examples from chapter 10. The questions
will be mostly short answers - no long explanations. Make sure
you understand the vocabulary.
Watch the first 40 minutes of this video:
http://www.youtube.com/watch?v=XgQo4JkN4Bw
Take notes so you can ask questions in the next class.
If ou don't have headphones, you can show the vidoe
to the whole class on the teacher's computer.
We will do some experiments to examine the multi-tasking capabilities
of a Windows PC. We will use this Java program: Primes.zip
We will discuss the reading and experiments about Operating Systems.
HL Students - Task Manager and Desktop Experiments during class
SL and HL Students - Read Chapter 10 in Computer Science
Illuminated
HL students can do this at home, SL students can
read during class
Read about Operating Systems
Read these online notes about operating systems.
HowStuffWorks
"How Operating Systems Work" (12 pages)
HOMEWORK -
Bring your TEXT-BOOK to class tomorrow (Friday).
Today's Printed Notes
Test Announcement - Mid Term test on
Tuesday 5 March
The test will cover all topics since 20 Jan 2013
Today:
Making a plan for the CIA Index
Program
HOMEWORK - Good news! Mr Mulkey found the time to upload the
CIA index program, so you don't need to type it in. But you DO
need to
improve it so that it ADDS UP THE RANKINGS for a country, so the
user doesn't need to write down results and add it up by hand.
Try to spend 30-60 minutes on this. If you don't succeed , you'll
still learn something by trying. Also, the notes below may be
helpful.
Here is the archive containing the program and data files:
http://dl.dropbox.com/u/239179/ibcomp/GUI/CIAfacts.zip
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Notes About the CIA Index Program
An index is a measurement produced by collecting a small set of
data for various entities.
For example, we can create a LIVABILITY INDEX by collecting 5
pieces of data for each country
from the CIA Factbook. Here are data for China and the United
States. We can use the
TOTAL or the AVERAGE to compare the two countries. Whether this is a
GOOD or BAD indicator
of livability (quality of life) is a very subjective question. And
whether the data is actually
reliable or correct is a bit uncertain. But an index value is still
more useful than statements like:
"I LIKE China better" or "I heard that lots of people are
leaving China".
Here are the index calculations:
Data Sources (Factors) |
United States Rankings |
China Rankings |
GDP per capita (2004) |
3 |
123 |
Electric. Consumption (2042) |
2 |
4 |
Labor Force (2095) |
4 |
1 |
Life Expectancy (2102) |
49 |
106 |
Investment (2185) |
122 |
6 |
Total / Average |
180 / 36 |
240 / 48 |
Assuming that higher rankings (smaller numbers) are better, the US has a
better index
than China. If we agree that the 5 factors shown provide sensible
measurements
of livability, then the US provides a higher quality of life than
China. On the other hand,
we might want to include other factors in our index. Also, we might
think that
GDP is more important than Labor Force, and hence would not count these
equally -
we would do a weighted average.
There is no "right way" to do an index. Social scientists can argue
for years about
which factors should be included and why.
Our problem as Computer Scientists is NOT to decide what is right and
wrong,
but rather to write a computer program to AUTOMATE the production of the
results.
Human beings should not waste their time reading large lists of data,
searching for results, writing down the results and then calculating
totals.
That work is better left to computers, to automated systems. The
human beings
should spend their time making higher level decisions, like which factors
should
be included in an index.
The following program does look up values automatically. You can
download
the program (together with all the data files) and try it out. This
is a BlueJ project,
so you should use BlueJ to run the program (load the "package" file).
http://dl.dropbox.com/u/239179/ibcomp/GUI/CIAfacts.zip
After finishing your quiz, read the notes about the CIA Factbook in this
file:
Information
vs Data
Then complete the Initial
Investigation. Be prepared to discuss your findings on
Friday - that means that you should have results for your country,
preferably results that are better than any other country.
public void actions(Object source,String command) { if(source == bWorst10) { worst10(); } if(source == bWorst10q) { worst10queue(); } if(source == bFindName) { String name = input("Name of country?"); findName(name); } } public void worst10queue() { // loop through the vector // at each entry, // copy that to the END of a second vector // if second vector.size > 10 // remove the first entry // That is a QUEUE First In, First Out // at the end, worst 10 are in the second vector //============================== Vector<PisaScore> worst = new Vector(); Iterator it = data.iterator(); while(it.hasNext()) { PisaScore ps = (PisaScore)it.next(); worst.add(ps); if(worst.size() > 10) { worst.remove(0); } } for(int x=0; x < worst.size(); x=x+1) { PisaScore ps = (PisaScore)worst.get(x); System.out.println(ps.nation + " " + ps.score); } } public void worst10() { // create an int called size = size of vector // create limit = size - 10 // counting int // use an Iterator // if count > limit then print it //============================= int size = data.size(); int limit = size-10; int counting = 0; Iterator it = data.iterator(); while(it.hasNext()) { PisaScore ps = (PisaScore)it.next(); if(counting >= limit) { System.out.println(ps.nation + " " + ps.score); } counting = counting + 1; } } |
Read these notes about Information vs Data.
Do #1-4 in the practice about PISA scores.
We will write a few more methods today,
and there will be a Quiz on Monday 11
Feb.
You might find this helpful: Vectors2.zip
How can we delete (remove) data from a Vector?
We need a few more BUTTONS and METHODS for our program.
For example:
Find the locker number for a name Find the name for a locker number Delete several lockers (whole HR) List of lockers (with names) for HR Alphabetical names Sorted by locker number Sort by HR then by name |
We need to make our program SAVE the locker data into a FILE on the
Hard-Disk.
We can use SERIALIZATION to do this. Don't worry about the details
just yet.
Type the following code into your VectorLockers program and get it
running.
Be sure that the QUIT button always executes the FINISH method.
Here is the Serialization code - add this to VectorLockers.java.
Notice that you must also change the Locker class so that it starts with:
public class Locker implements SerializableContinue with this sample program: lockers5.zip
1. Create a new BUTTON and a METHOD to print out
ALL of the locker assignements.
2. Add the method for [Allocate HR] that allocates
several lockers to a Homeroom Teacher.
ASSUME that the lockers are not currently assigned
public void allocateHR() { // showAllEmpties() // input HR teacher Edwards // input first 501 // input last locker 515 // loop from first to last // make locker // enter HR Teacher name into Locker // add it to the vector showEmpties(); String hr = input("Homeroom"); int first = inputInt("First"); int last = inputInt("Last"); for(int c = first; c <= last ; c++) { Locker temp = new Locker(); temp.homeroom = hr; temp.number = c; temp.student = "test" +c; // testing data.add(temp); } showNames(); } |
3. Create a method to DELETE a locker assignment
4. Create a better [Assign Student] method.
It needs to implement the following "business logic":
A Vector is like a combination of a Linked-List and an Array.
Here is a new version of our Lockers database : lockers4.zip
We will discuss Vectors in class, and you can do some
background reading in the handout from the teacher
Savitch ch 15, p 732-748). The rest is for reference later.
You might also find this summary helpful: Vectors
How To
Read the notes
about Automation
and do the practice as described.
Today's Lecture :
Design
Pattern for a standard GUI program
Homework :
Watch
these videos. Write down WORDS that you don't understand -
technical words that sound important. We will discuss them in class
tomorrow.
We
Are All Cyborgs
All
Your Devices Can Be Hacked 10
Mindful Minutes
Use some time today to make BACKUPS - extra
copies
of anything that is important to you.
Reminder - test tomorrow Wed 16 Jan about GUI programming
Today - finish the Lockers program Lockers Program
Read
these notes and do the exercises at the end.
Homework - Practice GUI programming - do any of the assignments
from today or the past 2 days
We will practice more on Monday and Tuesday and have
a test on Wednesday.
A TextArea is a box containing text, like this :
Read
these notes and write some programs with TextFields.
Test Announcement - We will have a written test about GUI
programming
next week on Wednesday
16 Jan.
We will start writing Object Oriented Programs (OOP)
using GUI controls - Graphic User Interfaces.
Read
these notes about a program to maintain a list of students
who check out early to go to the doctor or somewhere else.
It uses an Array of Objects to store the list of data.
Download
this Java class and read the notes at the end.
Discussed the homework reading sections
2.1-2.8 on this page.
Homework - read the same thing again, hoping that it makes
more sense after today's lecture.
Continue - we will continue discussing these notes about PARALLEL ARRAYS.
Online Java
Notes
This is a web-site with clear and understandable notes about Java.
It includes a clear
introduction to OOP (Object Oriented Programming).
Classwork
- Install BlueJ on your PC
and check that it works correctly
- Run one of the programs from the web-site above,
for example the PrimeList program on
this page
Homework
Read sections
2.1-2.8 on this page.
Compile and run the TestCircle program.
Notice that you must copy the Circle class into BlueJ,
as well as the TestCircle class, and then you must
execute the main method in the TestCircle class.
1. Do your test and turn it in
2. Homework - read
these notes, copy the program,
run the program, and add a method that prints
out the NAMES of all the items that cost under 2.00 .
Remember - Test on Thursday about Arrays
Here
is an almost complete solution to yesterday's assignment.
We will discuss useful techniques for TRACING and DEBUGGING
programs containing loops and arrays.
Do the problems in this document.
How do calendars work?
How can we store a calendar in Java?
How do board games work?
How can we store Tic-Tac-Toe or Mine Sweeper or KINGS in Java?
HL Homework -
Before next HL meeting, become a KINGS expert -
analyze the game and develop a winning STRATEGY.
(1) Finish the CD List Program problems
(2) Lots more practice with arrays
- add up all the numbers in an array
- find the largest number in an array
- count how many numbers are greater than 10
- find a number and delete it by changing it to zero
- print an array in reverse order
- REVERSE the order of numbers by exchanging [0] and
[length-1],
then exchanging [1] and [length-2] ...
until the MIDDLE
HOMEWORK - choose one of the problems above
and write a Java
program that solves it
We will have an ARRAY test on Thursday
6 Dec
(1) Finish the CANCEL method
(2) Questions from the reading (this
chapter392-398)
(3) CD
List Program
Work on this
sample program using arrays.
Homework -THINK about the following RESTRICTIONS
and how to PROGRAM a solution (automation)
- Need a minimum time
- need a flexible way to assign LENGTH of appointment
- use a loop to do this?
- Delete an appointment - fill it with "Cancelled" - need NULL
- MAYBE think of some other problem
Start
reading this chapter (p. 392 - 398)
** TEST about PEP/8 Assembly Language **
If you finish early, you may start your homework.
HOMEWORK -
Read
these notes.
Download the program, run it, try typing in appointments.
Observe any problems that occur.
Bring questions to class on Monday.
You do NOT need to do all the practice problems.
We need to finish the ALARM function for the digital
watch program.
The following program works correctly up to 23:59,
but does not stop there. It needs to be fixed.
br start ; skip over the data area
secone: .WORD 0 secten: .WORD 5 minone: .WORD 7 minten: .WORD 5 hrone: .word 9 hrten: .word 1 start: deco hrten,d deco hrone,d charo ':',i deco minten,d deco minone,d charo ':',i deco secten,d deco secone,d charo 13,i ; now we add one second lda secone,d adda 10,i sta secone,d cpa 10,i brlt start ; secone has reached 10, need to reset to 0 lda 0,i sta secone,d ; now increase secten by 1 lda secten,d adda 1,i sta secten,d cpa 6,i brlt start ; secten is 6, need to set it back to 0 lda 0,i sta secten,d ; now increase minutes by 1 lda minone,d adda 1,i sta minone,d cpa 10,i brlt start ; minone is 10, need to set it back to 0 lda 0,i sta minone,d ; now need to increase minten by 1 lda minten,d adda 1,i sta minten,d cpa 6,i brlt start ; now we have arrived at 60 minutes ; need to set minutes back to 0 and add 1 to hours lda 0,i sta minten,d lda hrone,d adda 1,i sta hrone,d cpa 10,i brlt start ; now we have 10 in hrone - need to reset to 0 ; then add 1 to hrten lda 0,i sta hrone,d lda hrten,d adda 1,i sta hrten,d cpa 2,i brle start stop .END |
Here is a sample PEP/8 assembler program that adds two numbers,
one digit at a time. We will expand this program to do more
digits,
maybe using a LOOP to make quite long numbers.
br start
xones: .word 3 xtens: .word 2 xhuns: .word 1 xthos: .word 0 yones: .word 6 ytens: .word 5 yhuns: .word 4 ythos: .word 0 zones: .word 0 ztens: .word 0 zhuns: .word 0 zthos: .word 0
adda yones,d sta zones,d cpa 10,i brlt dotens suba 10,i sta zones,d lda xtens,d adda 1,i sta xtens,d
adda ytens,d sta ztens,d cpa 10,i brlt dohuns suba 10,i sta ztens,d lda xhuns,d adda 1,i sta xhuns,d
sta zhuns,d
sta 999,d deco 999,d lda ztens,d sta 999,d deco 999,d lda zones,d sta 999,d deco 999,d stop .end |
We will spend a week writing assembly language programs
using the PEP/8 emulator. You are expected to learn and
understand
everyting in section 6.4 (p. 166-174).
Test Announcement - test on Tue 20 Nov
The test will focus on assembly language, with a few connected
questions about compatibility between different platforms.
Today - continue with the sample programs in these notes .
HOMEWORK - In your textbook, read p 151-174
(read quickly, details are not important)
EUROS = 75 print "Euros = " ; EUROS POUNDS = 0.8*EUROS print POUNDS ; " BP" YEN = EUROS * 90 if YEN > 1000 then print "That is a lot of Yen" end if |
Homework - create a method that accepts a month number (1-12) as a
parameter,
and returns the number of days in that month - assume February has 28
days.
You can start like this:
void setup() { int d = countDaysInMonthy(2); println( d ); } int countDaysInMonth(int m) { int answer = 0; if(m == 1){ answer = 31; } if(m == 2){ answer = 38; } // .... return answer; } |
We will make a list of vocabulary words associated with control
systems
that use embedded processors.
First we will watch a couple videos:
- Smart Vending
Machine
- Billiard
Robot
- Robot Car
We will spend two days working on this program:
http://dl.dropbox.com/u/239179/ibcomp/processing/overdueBooks/index.html
Today, read the notes, download the program and make changes
as outlined in the practice section.
Here is a solution for problem #2 from Friday:
void setup() { String correct = "secret"; String pw = input("Guess the password"); if(____________________) { output("right"); System.exit(0); } int letters = ____________; // number of letters in password output("No, here's a hint: there are " + letters + " letters"); pw = input("Guess again"); if(__________________) { output("Right on the second try"); System.exit(0); } output("Wrong again"); char first = ________________; // first letter char last = ________________________________; // last letter output("First letter = " + first); output("Last letter = " + last); pw = input("Third guess"); if(____________________) { output("Right on the third guess"); System.exit(0); } output("This is your last try ... I'm tired of typing"); output("It has the same letters as _____________"); // scrambled letters pw = input("Fourth and final guess"); if(___________________________) { output("YES!! Finally"); System.exit(0); } output("Give up? The secret word is 'secret'"); } public String input(String prompt) { return javax.swing.JOptionPane.showInputDialog(null,prompt); } public void output(String message) { javax.swing.JOptionPane.showMessageDialog(null,message); } |
In these notes String
Examples ,
do program #2. Spend one class period
on this and no more than 30 minutes
at home. Complete as much as you can
in that time and bring your program to class
on Monday.
You might want to read these notes : Savitch
1.3
These pages contain some useful examples.
String Quiz (5 minutes)
HL students will each give a 5 minute presentation about
a common embedded processor system, assigned last Monday.
REMINDER - On Thursday, HL students will present a 5 minute
explanation of their chosen topic (below).
We will discuss more String methods today.
We will have a 5 minute quiz on Thursday - about String methods.
String
Methods
String
Examples
Homework - try out #3 (you need to copy INPUT and OUTPUT methods, too)
Try to do at least one of parts a,b,c.
Optional reading : Savitch 1.3 or Baldwin
or Blue Pelican Lesson 3 & 17
Background Reading : Automation
IB Syllabus 7.1.1 : Discuss a range of control systems.
A variety of control systems should be examined such as automatic
doors, heating systems (Evan) , taxi meters, elevators (Jonas),
washing machines (Tanmay), process control, device drivers,
domestic robots (Alex), GPS systems (Martin), traffic lights (Yasin)
`and other common devices.Technical knowledge of specific systems is not expected but
students should be able to analyze a specified system.
IB Computer Science Course Guide p.39
We will write some sample control programs in Java.
In each case, consider the following questions:
You might want to think about the processing first,
and then think about inputs and outputs.
Homework - Due Thursday 18 Oct
Each student should take one of the systems mentioned above
and answer the 4 questions, then present the answers to the class.
Prepare your presentation as homework, including some pictures -
recommend using Google Images. And please include the
words "for example" frequently during your presentation.
Your presentation should last no more than 5 minutes.
Due Date : You will present your answers on Thursday 18 Oct.
** Definition of ERROR **
== Types of Programming Errors ==
There are other kinds of errors in computer systems,
but these are the most important for programmers.
For those who asked, here is an input method that keeps the password
hidden:
public String inputPassword(String prompt) { javax.swing.JPasswordField pwd = new javax.swing.JPasswordField(10); javax.swing.JOptionPane.showMessageDialog( null, pwd,"Enter Password",javax.swing.JOptionPane.OK_CANCEL_OPTION ) ; return new String(pwd.getPassword()); } |
We will be studying LOGICAL THINKING and the way that computers perform
LOGICAL OPERATIONS.
We can start with a PUZZLE :
http://www.novelgames.com/flashgames/game.php?id=54&l=e
We will look at this sample program about Dates :
http://dl.dropbox.com/u/239179/ibcomp/pseudocode/pcode.html
(open Data Validation)
Homework : read about if..else if..else commands -
http://math.hws.edu/eck/cs124/javanotes6/c3/s5.html
We will use Audacity and FrHed to look at some sound data.
You can get a copy of Audacity from V:\Mulkey Dave\PortableApps -
copy the entire Audacity folder. Or you can download it from
http://audacity.sourceforge.net/
Today - Discuss the Java
programs from Friday.
Homework - Read section 3.4 about Audio
storage
Bring headphones to class tomorrow.
---------------------------------------------------------------
*** Test Announcement ***
We will have a written test on Monday 24 Sep.
It will cover all of Chapter 3 in your textbook,
as well as all the Java programs and other
experiments we studied in the past few weeks.
Do the programming practice exercises in the following two lessons:
Solve
Math Equation , Car
Trip
If you don't finish all that during class, spend 40 minutes at home to
finish as much as you can. Don't spend more than 40 minutes.
Homework : Bring questions/comments about these programming tasks
when you come to class on Tuesday.
Hex
Editor Practice (continue)
We will investigate storage of floating point numbers,
and the common errors that occur due to rounding and truncation
of binary storage. Here are some notes about binary storage
of primitive variable types:
http://duke.csc.villanova.edu/jss/webBonuses/primitiveStorage/primitiveStorage.pdf
For example, these calculations produce incorrect results:
println(0.1+0.1+0.1+0.1+0.1+0.1+0.1);
println(0.1*0.1);
Introductory
Slideshow
Binary
Storage Examples
Hex viewer/editor
Homework :
HL students - read section 3.3 in your textbook (or
the handout)
SL students - read only p. 66-68 - the part about
Compression is optional
Computers store numbers in memory locations, like boxes.
We can use variable names to
identify these memory locations.
For this to work sensibly, we must declare
the type of numbers
that will be stored in the memory location, because a memory
just contains bits, and they can be interpreted
in a variety
of ways to produce a variety of different values.
A Java program with variables looks like this:
float x = 5 ;
float y = (x-3)*(2x+4) ;
println(x + " , " + y) ;
Read
these notes and do the exercises and answer the questions.
Homework : Read "Binary Representations" at the end of section 3.1.
Also read section 3.5 .
Read these notes, do the
exercises and answer the questions.
We will look at various causes of errors in computer calculations,
especially limits caused by finite storage space.
Resources for studying numbers
and data representation in
computers.
Today : First experience
with Java programming - Java
calculations.
If you don't find Processing on your computer,
you can download processing here.
Processing is multi-platform -
that means it runs
the
same on Windows, Mac and Linux.
Homework : Read 3.2 in the handout
Keyword Cipher
Code
Breaking Video
We will discuss the Future PCs scenario in these notes:
http://dl.dropbox.com/u/239179/ibcomp/systems/computerSystems.html
We will discuss a few more ideas from chapter 1 today.
Afterward, finish organizing the online
shared vocabulary list.
You can finish adding content as homework. Use web-sites,
ask questions and employ any other useful resources.
** Room Change **
On Monday and Tuesday next week (27-28 Aug) our class will
meet in Room 289. There are
a sufficient number of computers
available for our work.
== Test Announcement ==
We will have a written
test on Tuesday 28 Aug (pd 4).
You are permitted to use any available computers and any
notes that you bring with you, as well as any web-sites
that might be useful. You may NOT communicate with other
people during the test - neither electronically nor in-real-life.
Make plans and prepare accordingly. The test will cover all
notes that and lectures from this year (except there will
be no questions for HL about robots). Presumably any words
that are NOT listed on our vocabulary list are already well
understood and may appear on the test.
Study Questions for Chapter 1 in
Computer Science Illuminated:
Try to answer some of the questions at the end of the chapter.
We will make a list of vocabulary from the Chapter 1 reading.
Group (system) assignment -
Make ONE list containing ALL the words that you all highlighted.
Where possible, add EXAMPLES and EXPLANATIONS that contain
the ESSENTIAL ELEMENTS of that term.
Use www.webopedia.com or any other reliable source
We will discuss the recent Mars Curiosity landing, as well as other
robots.
Here are some useful links for the discussion:
http://www.nasa.gov/mission_pages/msl/index.html
http://www.howstuffworks.com/robot.htm
We want to answer the following questions:
We will discuss digital devices,
history and future.
Hopefully you have all done the reading assignment - chapter 1 from
Computer Science Illuminated.
Homework :
Read Chapter 1 of Computer Science Illuminated (handout) again.
Mark important vocabulary, especially words that you don't understand.
We will collect a comprehensive list tomorrow.