![]() |
![]() Spring Semester 2003 |
Thu Jun 5
Tue May 6
Sun May 4
There are two options:
For the second option:
Thu-Sat May 1-3
Please check your grades and report what's missing.
Wed Apr 30
Thanks a lot for your feedback!
Here's a program very much like Homework Five...
Tue Apr 29
Lab Twelve is asking you to go through all QuizSite exercises by May 4.
In lab this week
All grades except Homework Five and Lab Twelve should be up by then (May 1-2).
Final Exam is on May 6 5-7pm in Rawles 100.
All grades including Homework Five and Lab Twelve should be up by May 5, 11:59pm.
Mon Apr 28
Quizzes Eight and Nine have been posted. Lab Twelve (Quizzes 1-10) is due May 4.
Sat-Sun Apr 26-27
A bigger update is under way, but please check already.
Hope your weekend will be a good one!
Fri Apr 25
Thu Apr 24
Wed Apr 23
dgerman-Q201
)
for the makeup in QuizSite.
Mon-Tue Apr 21-22
import java.applet.*; import java.awt.*; import java.awt.event.*; /* <applet code=One.class width=300 height=300></applet> */ public class One extends Applet implements MouseListener, MouseMotionListener { public void init() { e1 = new Eye(); e2 = new Eye(); n = new Nose(); m = new Mouth(); this.addMouseListener(this); this.addMouseMotionListener(this); } public void paint(Graphics g) { e1.draw(g); e2.draw(g); n.draw(g); m.draw(g, out); System.out.println("paint has finished..."); } public void mouseDragged(MouseEvent e) { } public void mouseMoved(MouseEvent e) { out = false; } boolean out = true; Eye e1, e2; Nose n; Mouth m; public void mousePressed(MouseEvent e) { } public void mouseReleased(MouseEvent e) { } public void mouseClicked(MouseEvent e) { } public void mouseExited(MouseEvent e) { out = true; System.out.println("Out..."); repaint(); } public void mouseEntered(MouseEvent e) { out = false; System.out.println("Back in!"); repaint(); } } class Eye { public void draw(Graphics g) { } } class Nose { public void draw(Graphics g) { } } class Mouth { int x, y, width = 300, height = 150, start = 190, stop = 160; public void draw(Graphics g, boolean out) { if (out/* == true*/) { System.out.println("Broad smile."); g.drawArc(x, y, width, height, start, stop); } else { System.out.println("Attentive smile..."); g.drawArc(x, y, width, height, start + 40, stop - 2 * 40); } } }
Sat-Sun Apr 19-20
Quiz_Ten
has been posted. It's by far the most involved so it's better to post it first.
Two more are coming and that will be it (only ten in all).
Fri Apr 18
Thu Apr 17
You don't need to come to lab if you don't take the exam.
Everybody is more than welcome to the exam, of course.
Here's the code we developed in class today:
* <applet code="Six.class" width=600 height=600> </applet> */ import java.awt.*; import java.applet.*; import java.awt.event.*; public class Six extends Applet implements MouseMotionListener { Device[] d = new Device[8]; // (100, 100, 60, 20, 100, 100); public void init() { this.addMouseMotionListener(this); for (int i = 0; i < d.length; i++) { int xC = (int) (Math.random() * (2 * 180)) + (100 - 180); int yC = (int) (Math.random() * (2 * 180)) + (100 - 180); int R = (int) (Math.random() * (2 * 5)) + (60 - 5); int r = (int) (Math.random() * (2 * 5)) + (20 - 5); d[i] = new Device(xC,yC,R,r,xC,yC); } } public void paint(Graphics g) { for (int i = 0; i < d.length; i++) d[i].draw(g); } public void mouseMoved(MouseEvent e) { for (int i = 0; i < d.length; i++) { d[i].xTarget = e.getX(); d[i].yTarget = e.getY(); } repaint(); } public void mouseDragged(MouseEvent e) { } } class Device { int xCenter, yCenter, Radius, radius, xTarget, yTarget; Device(int xC, int yC, int R, int r, int xT, int yT) { xCenter = xC; yCenter = yC; Radius = R; radius = r; xTarget = xT; yTarget = yT; } void draw(Graphics g) { g.drawOval(xCenter - Radius, yCenter - Radius, 2 * Radius, 2 * Radius); int a, b; // a = xCenter - radius; b = yCenter - radius; double dist = Math.sqrt((xTarget - xCenter)*(xTarget - xCenter) +(yTarget - yCenter)*(yTarget - yCenter)); if (dist < Radius - radius) { a = xTarget - radius; b = yTarget - radius; } else { double t = (Radius - radius) / dist; a = (int) (xCenter + t * (xTarget - xCenter)) - radius; b = (int) (yCenter + t * (yTarget - yCenter)) - radius; } g.fillOval(a, b, 2 * radius, 2 * radius); g.drawLine(xCenter, yCenter, xTarget, yTarget); } }
Wed Apr 16
CSCI-A201-Instructor_Name
). More quizzes should be posted in QuizSite.
Solutions to practical makeup problems should be posted today.
Tue Apr 15
Here's the code we developed in class today:
import java.applet.*; import java.awt.*; import java.awt.event.*; /* <applet code="Two.class" width=300 height=300> </applet> */ public class Two extends Applet implements MouseMotionListener, MouseListener { Eye a = new Eye(20, 20, 30, 30); public void init() { this.addMouseMotionListener(this); this.addMouseListener(this); } public void paint(Graphics g) { a.draw(g); } public void mouseDragged(MouseEvent e) { // a.x = e.getX() - a.w / 2; // a.y = e.getY() - a.h / 2; a.w = e.getX() - a.x; a.h = e.getY() - a.y; repaint(); } public void mouseMoved(MouseEvent e) { } public void mouseClicked(MouseEvent e) { } public void mousePressed(MouseEvent e) { a.x = e.getX() - a.w / 2; a.y = e.getY() - a.h / 2; repaint(); } public void mouseReleased(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } } class Eye { int x, y, w, h; Eye(int x, int y, int w, int h) { this.x = x; this.y = y; this.w = w; this.h = h; } void draw(Graphics g) { g.drawOval(x, y, w, h); } } import java.applet.*; import java.awt.*; import java.awt.event.*; /* <applet code="One.class" width=300 height=300> </applet> */ public class One extends Applet implements MouseMotionListener, MouseListener { public void init() { this.addMouseMotionListener(this); this.addMouseListener(this); } int x0 = 100, y0 = 10, x1 = 12, y1 = 120; public void paint(Graphics g) { this.drawLine(x0, y0, x1, y1, g); } void drawLine(int x0, int y0, int x1, int y1, Graphics g) { for (double t = 0; t <= 1; t += 0.05) { int x = (int) (x0 + t * (x1 - x0)); int y = (int) (y0 + t * (y1 - y0)); // System.out.println(t); g.setColor(Color.red); g.fillOval(x, y, 6, 6); g.setColor(Color.blue); g.drawOval(x, y, 6, 6); } } public void mouseDragged(MouseEvent e) { int x = e.getX(), y = e.getY(); x1 = 300 - x; y1 = 300 - y; this.repaint(); } public void mouseMoved(MouseEvent e) { } public void mouseClicked(MouseEvent e) { } public void mousePressed(MouseEvent e) { int x = e.getX(), y = e.getY(); x0 = x; y0 = y; } public void mouseReleased(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } }
Mon Apr 14
Sat-Sun Apr 12-13
Review notes (27) for inheritance and abstract classes have been posted.
Homework Five has been
posted. (Double buffering help is provided).
Thu-Fri Apr 10-11
Wed Apr 9
Here's the code we developed in class yesterday:Date: Wed, 9 Apr 2003 21:58:08 -0500 (EST) From: Adrian German <dgerman@cs.indiana.edu> To: A201 Spring 2003 Distr. List <dgerman@indiana.edu> Subject: A201/A597/I210 Update Dear A201/I210/A597 Friends, I would like to remind everyone that the appointment script is located at http://burrowww.cs.indiana.edu:11400/cgi-bin/appts/schedule I've had so far about 84 appointments in A201 and A348 (for a combined enrollment of 260 students or so) so I estimate I will have about twice as many in the upcoming 7 days (appointments end next Tuesday). Please take a brief moment to schedule an appointment so we can talk about your performance in the course. Grades are mostly up to date. Homework Five is the last homework and I have not posted a due date yet. The list of problems for the Practical Makeup is going to be finalized tomorrow at 5pm. There will be two more lab assignments after Lab Ten (Eleven and Twelve) and that will be it, as far as assignments go for A201 this semester. As I mentioned in class on Tuesday we're entering the last phase of the course, with a two-three week period of review in which we will be using mostly the textbook (Big Java, chapters covered thus far). There's a Practical Makeup next week. A Midterm Two Makeup the week after, that will also serve as a Warmup for the final. The Final is on May 6 and you will have an option to choose the format -- you will have to communicate it to me (through QuizSite) the format you prefer: either a problem from the ones that you are preparing for the Practical Makeup or a multiple-choice test with questions from QuizSite. All remaining exams (the two makeups and the final) will be closed-book, closed-notes, no resources other than your own knowledge. Please let me know if you need any help and don't forget to make an appointment on-line (at the URL indicated above) so we can meet and talk about the course and you to be sure that everybody is approaching these last few weeks of review and makeup opportunities in the best possible way. ... Adrian
/* <applet code="One.class" width=300 height=300> </applet> */ import java.applet.*; import java.awt.*; import java.awt.event.*; public class One extends Applet { public void init() { Umpire a = new Umpire(); this.addMouseMotionListener(a); } public void paint(Graphics g) { for (int i = 0; i < 100; i++) { int x = (int)(Math.random() * 250 + 25), y = (int)(Math.random() * 250 + 25), w = (int)(Math.random() * 50 + 50), h = (int)(Math.random() * 50 + 50); Color c = new Color((int)(Math.random()*255), (int)(Math.random()*255), (int)(Math.random()*255) ); g.setColor(c); g.fillOval(x, y, w, h); g.setColor(Color.black); g.drawOval(x, y, w, h); } } } class Umpire implements MouseMotionListener { public void mouseDragged(MouseEvent e) { } public void mouseMoved(MouseEvent e) { System.out.println("Mouse at: (" + e.getX() + ", " + e.getY() + ")"); } }
Tue Apr 8
Mon Apr 7
Please come during these times to make sure I am here.
Sat-Sun Apr 5-6
The PRACTICAL MAKE-UP will be on Apr 17-18, in lab(s).
The MIDTERM TWO MAKE-UP will be on Apr 24, in class (RH 100).
Details to follow.
Fri Apr 4
The average was 69.77 and the standard deviation was 16 (both out of 100).
Here's the distribution of scores:
The maximum score was 99 (55 questions at 1.8 points each).above 95: 6 ****** 90-95 13 ************* 85-90 17 ***************** 80-85 13 ************* 70-80 36 ************************************ 60-70 29 ***************************** 50-60 27 *************************** below 50 20 ********************
Thu Apr 3
Here's the
midterm of
yesterday.
If you look closely you will realize
Wed Apr 2
![]() | |
![]()
|
![]() Morrison Hall 007 |
Tue Apr 1
Today in class we will discuss QuizSite exercises for tomorrow's exam.
Mon Mar 31
Sat-Sun Mar 29-30
Please take the time to check the QuizSite exercises available.
Here's some help with eliminating the leading zero(e)s:
Notice that this is written in the style required for Lab Eight.class Example { public static void main(String[] args) { String[] numbers = args; // = { "0000070001", "0000000000", "9000000000" }; for (int i = 0; i < numbers.length; i++) { System.out.println(Example.transform(numbers[i])); } } public static String transform(String number) { // our focus, actually... String result = ""; boolean done = false; for (int i = 0; i < number.length(); i++) { if ((!done) && (number.charAt(i) == '0') && (i != number.length() - 1) ) result += "_"; else { result += number.charAt(i); done = true; } } return result; } }
Here's how it runs:
We're using the command line arguments so we don't compile every time.drJava> java Example 00000001 90000000 90010000 00010001 00000000 _______1 90000000 90010000 ___10001 _______0
Thu-Fri Mar 27-28
Midterm Two Exam is next Wednesday, Morrison 007 (7-9pm).
Midterm Two is multiple-choice, open book, study quizzes in QuizSite.
Lab
Eight is now due on-line (in QuizSite, like Lab Seven) on Wed, Apr 2.
Wed Mar 26
import javax.swing.JOptionPane; class One { public static void main(String[] args) { String in1, in2; int n1, n2; in1 = JOptionPane.showInputDialog("Please enter the first number"); n1 = Integer.parseInt(in1); in2 = JOptionPane.showInputDialog("Please enter the second number"); n2 = Integer.parseInt(in2); System.out.println("max(" + n1 + ", " + n2 + ") = " + (n1 + n2 + Math.abs(n1 - n2)) / 2); } }If this doesn't seem to work only use DrJava to compile.
The Second Midterm will be (on April 2) a multiple-choice, open-book exam.
The Make-up Practical Exam will be graded by the AIs.
Tue Mar 25
It will ask you to develop a program, e.g. one of the following:
Report
Line
Clock
Paper
Tigger
Oracle
Elevator
Hanoi
Fraction
... and many more (say, up to about 50 programs).
So by the end of this week (Mar 28) I will post here a complete list of problems.
The problems on the list will be posted with a solution.
For the make-up practical you need to
During the make-up practical proctors may take and answer simple API questions.
The problem you will get on the make-up practical will be:
And the exam is closed-book
Mon Mar 24
"I have been trying to get the parseInt to work all night.
This program should read all the numbers ... and then see if they
can divide by two if they do then they get the paranthesis.
This is a very important comment.
Here's the Bracketizer
as a number Historian
:
Here's how it runs:import java.util.*; class Bracketizer { int[] memory; int available; Bracketizer(int size) { this.memory = new int[size]; } void record(int n) { this.memory[available] = n; this.available += 1; } void report() { for (int i = 0; i < this.available; i++) if (this.memory[i] % 2 == 0) System.out.print("(" + this.memory[i] + ") "); else System.out.print("[" + this.memory[i] + "] "); System.out.println(); } public static void main(String[] args) { ConsoleReader c = new ConsoleReader(System.in); String line; System.out.println("Welcome to the [B][r](a)[c][k](e)[t](i)[z](e)[r]"); System.out.print("enter> "); line = c.readLine(); while (! line.equals("done")) { StringTokenizer stapler = new StringTokenizer(line); Bracketizer stanley = new Bracketizer(stapler.countTokens()); while (stapler.hasMoreTokens()) stanley.record(Integer.parseInt(stapler.nextToken())); stanley.report(); System.out.print("enter> "); line = c.readLine(); } } }
Note that:frilled.cs.indiana.edu%javac *.java frilled.cs.indiana.edu%java Bracketizer Welcome to the [B][r](a)[c][k](e)[t](i)[z](e)[r] enter> 1 2 3 4 5 [1] (2) [3] (4) [5] enter> enter> -1 -2 -3 0 0 0 1 100 200 101 201 [-1] (-2) [-3] (0) (0) (0) [1] (100) (200) [101] [201] enter> done frilled.cs.indiana.edu%
Sun Mar 23
Date: Fri, 14 Mar 2003 12:22:41 -0500 (EST) From: Adrian German <dgerman@cs.indiana.edu> To: A201/A597/I210 Spring 2003 Distr. List <dgerman@indiana.edu> Cc: Adrian GermanSubject: A201 Spring Break Update Dear A201/A597/I210 friends, I am writing mostly to wish you a good break, and to let you know that after the break (and before the second midterm exam scheduled on the 2nd of April) I plan to set up individual appointments with each one of you, to discuss your performance in the course thus far, in the first midterm, the make-up (if any,) and the practical. Since we come back on March 22, that means we have about 10 days between when school starts and when we need to take the second midterm exam, and in those 10 days I want to talk to each one of you. Since I co-teach 2 lab sections I'll probably focus on those of you that I haven't worked with directly, thus far, mostly, since I would be talking with the rest in the lab. E-mail appointments will be acceptable also, under certain circumstances, to be detailed later. So when we come back from the break I will have details on how we arrange these individual appointments, to make sure we all finish this semester in triumph (or as close to that as we could possibly get). Have a great break and we'll be seeing you (literally) when you come back. ... Adrian P.S. We're still updating the grades. Grades will be updated throughout the day today and tomorrow, before we close the gradebook for the break.
Mon-Sat Mar 17-22
Sun Mar 16
After the break we'll switch to using
Dr. Java in labs.
|
![]() |
![]() |
Sat Mar 15
Historian
code:
import java.util.*; class Historian { int max = 0; int min = 0; int sum = 0; int num = 0; void record(int a) { this.sum += a; if (this.num == 0) { this.min = a; this.max = a; } if (this.min > a) this.min = a; // a bit redun- if (this.max < a) this.max = a; // dant sometimes this.num += 1; // order of updates is important! } void report() { if (this.num == 0) { System.out.println("Nothing to report on..."); } else { System.out.println ( " I've looked at " + this.num + " number(s) thus far.\n" + " The largest I've seen was " + this.max + "\n The smallest was " + this.min + "\n The average of the numbers is " + this.sum / (double) this.num ); } } // testing... public static void main(String[] args) { ConsoleReader c = new ConsoleReader(System.in); String line; System.out.println("Welcome to the Historian!"); System.out.print("enter> "); line = c.readLine(); while (! line.equals("done")) { StringTokenizer stapler = new StringTokenizer(line); Historian herodotus = new Historian(); while (stapler.hasMoreTokens()) { herodotus.record( Integer.parseInt( stapler.nextToken())); } herodotus.report(); System.out.print("enter> "); line = c.readLine(); } } }Note we're getting closer to arrays, but we're not there yet.
Notice also that every Historian
works with a
stapler
.
Here's a session with this program:
The empty line problem is solved with a count of numbers seen thus far.frilled.cs.indiana.edu%java Historian Welcome to the Historian! enter> 1 2 3 I've looked at 3 number(s) thus far. The largest I've seen was 3 The smallest was 1 The average of the numbers is 2.0 enter> -1 -3 4 2 5 0 -1 I've looked at 7 number(s) thus far. The largest I've seen was 5 The smallest was -3 The average of the numbers is 0.8571428571428571 enter> Nothing to report on... enter> 0 I've looked at 1 number(s) thus far. The largest I've seen was 0 The smallest was 0 The average of the numbers is 0.0 enter> done frilled.cs.indiana.edu%
This solution was suggested in about 8 minute papers on Tuesday.
Fri Mar 14
class Historian { int gTF = 0; // greatestThusFar boolean start = false; void feed(int a) { if (start) { if (a > this.gTF) { this.gTF = a; // start = true; } } else { this.gTF = a; start = true; } } void report() { if (start) { System.out.println("Max: " + this.gTF); } else { System.out.println("We haven't started yet."); } } public static void main(String[] args) { Historian a = new Historian(); a.report(); for (int i = 0; i < 6; i++) { int n = (int)(Math.random() * 100); System.out.print("Chosen: " + n + " "); a.report(); a.feed(n); } a.report(); } }
Thu Mar 13
Wed Mar 12
Nothing is due in labs this week.
So we will use the lab(s) as follows this week:
Especially the last point will be fundamental.
Tue Mar 11
Please note the due dates of Homework Four and labs Eight and Nine.
The Second Midterm Exam is on April 2, 2003.
Sun-Mon Mar 9-10
Sat Mar 8
With this exam we are bouncing into Graceland. This exam is a learning experience:
Try to
|
![]() ... like a window in your heart |
Thu-Fri Mar 6-7
Please remember to be there on time.
Wed Mar 5
Tue Mar 4
Here's the minute paper for today.
Consider the following program with a few lines missing:
When you run this program (with the missing code in) one obtains:class One { public static void main(String[] args) { int x = 3, y = 5; System.out.println("x = " + x + ", y = " + y); // ... code erased here System.out.println("x = " + x + ", y = " + y); } }
Write the missing code without using anything else butfrilled.cs.indiana.edu%java One x = 3, y = 5 x = 5, y = 3 frilled.cs.indiana.edu%
x
and
y
. You can't use any other variable(s).
If you could, though, how would you do it?
Mon Mar 3
You are to write the RootApproximator
program to solve P6.12 on
page 278 of Big Java.
Sat-Sun Mar 1-2
Practical exam next week
is
Web notes are fine but no e-mail, no chat, no file sharing is allowed.
Fri Feb 28
Thu Feb 27
class StrawDispenser { final static CAPACITY = 100; int balance = StrawDispenser.CAPACITY; Straw dispense() { this.balance -= 1; return new Straw(); } int getBalance() { return this.balance; } void refill() { this.balance = StrawDispenser.CAPACITY; } }
A similar (perhaps even better) example would be this:
This is a bubble machine, in case you're wondering.
Wed Feb 26
Midterm One Makeup today:
|
![]() Morrison Hall |
dgerman-Q201
)
Tue Feb 25
Mon Feb 24
Two new quizzes posted in QuizSite so you can practice with loops.
Homework Three, posted, is due before the Practical Exam.
List of problems to be worked out before the Midterm Makeup updated.
Sat-Sun Feb 22-23
Here's a local copy of the same picture.
More details about the exam to be posted here soon.
Fri Feb 21
Details to follow. Tuesday lecture is a (New) Review.
Thu Feb 20
And theclass NumberTwo { Sandwich a; Fries f; Drink d; NumberTwo(int size, String drink) { a = new Sandwich("cheeseburger"); f = new Fries(size); d = new Drink(drink, size); } }
Triangle
exercise:
class Point { double x; double y; Point(double a, double b) { this.x = a; this.y = b; } double dist(Point other) { double dX = this.x - other.x, dY = this.y - other.y; return Math.sqrt( dX * dX + dY * dY); } } class Triangle { Point a, b, c; Triangle (double x1, double y1, double x2, double y2, double x3, double y3) { this.a = new Point(x1, y1); this.b = new Point(x2, y2); this.c = new Point(x3, y3); } double area() { double m = a.dist(b), n = b.dist(c), q = a.dist(c), s = (m + n + q) / 2; return Math.sqrt(s * (s - m) * (s - n) * (s - q)); } } class Experiment { public static void main(String[] args) { Triangle a = new Triangle(0, 0, 0, 3, 4, 0); System.out.println(a.area()); // prints 3 * 4 / 2 (that is: 6 (six)) System.out.println((new Point(0, 3)).dist(new Point(4, 0))); // (5.0) } }
Wed Feb 19
Here's what you can practice with:
Solutions to most of these questions and problems can be found
Tue Feb 18
The problem, of course, read like this:class Athlete { String name; double weight; Athlete(String givenName, double givenWeight) { name = givenName; weight = givenWeight; } void report() { System.out.println(name + ": " + weight); } void eat(int bagels) { this.report(); System.out.println( "My name is " + name + " and I am just about to eat " + bagels + " bagels." ); weight += bagels * 0.25; System.out.println( "My name is " + name + " and I have just eaten " + bagels + " bagels." ); this.report(); } void workOut(int minutes) { this.report(); System.out.println( "My name is " + name + " and I am just about to work out for " + minutes + " minutes." ); double lostWeight = minutes / 20.0 * 0.75; weight -= lostWeight; System.out.println( "My name is " + name + " and I am just finished a " + minutes + " minutes work-out." ); this.report(); } } class Story { public static void main(String[] args) { Athlete a = new Athlete("George Foreman", 300); a.report(); Athlete b = new Athlete("Riddick Bowe" , 250); b.report(); a.eat(1000); b.eat(15); b.workOut(12000); b.eat(20000); // and so on } }
Implement a classAthlete
. OurAthlete
s can do two things:eat(...)
andworkOut(...)
. When theyeat()
theirweight
goes up. When theyworkOut()
theirweight
goes down. They eat (anumber
of ) bagels, they work out anumber
of hours. Every bagel that they eat raises the weight by 0.25 pounds. Every 20 minutes of work-out will lower their weight by 0.75 pounds.Athlete
s canreport()
their weight if they're asked to, and come into existence with a specific weight. (Later we also indicate thatAthlete
s should also be able to report theirname
along with their weight.) Now write the story below:Once upon a time there were two
Athlete
s: one of them was called"George Foreman"
and was created with a weight of300
pounds, and another one was named"Riddick Bowe"
, created at about250
pounds. They both reported their weights, then ate bagels. George ate 1,000 bagels, reported his new weight, then worked out for 1,200 minutes, and reported his weight again. He was able to report his name along with his weight, asAthlete
s always are. He then retired. Riddick's career was a bit different. He first ate about 15 bagels and then he started working-out. He worked out about 12,000 minutes non-stop, and when he finished he felt very hungry. So he ate about 20,000 bagels and then reported his name and weight. Then he also retired. That was the end of his career, and this is the end of our story.
Also, please don't forget to check the
Jace
problem below.
Mon Feb 17
This is a good example of how delegating responsibilities simplifies theclass Jace { public static void main(String[] args) { int number = 131; Wizard someone = new Wizard(); int result = someone.convert(number); System.out.println(result); System.out.println(someone.convert(1)); System.out.println(someone.convert(2)); System.out.println(someone.convert(3)); System.out.println(someone.convert(4)); System.out.println(someone.convert(5)); System.out.println(someone.convert(6)); System.out.println(someone.convert(7)); System.out.println(someone.convert(8)); System.out.println(someone.convert(9)); System.out.println(someone.convert(10)); System.out.println(someone.convert(11)); System.out.println(someone.convert(12)); System.out.println(someone.convert(13)); System.out.println(someone.convert(14)); System.out.println(someone.convert(15)); System.out.println(someone.convert(16)); System.out.println(someone.convert(17)); System.out.println(someone.convert(18)); System.out.println(someone.convert(19)); } } class Wizard { int convert(int x) { int y = 00000000; if ( x >= 128 ) { x = x - 128; y = 10000000; } if ( x >= 64 ) { x = x - 64; y = y + 1000000; } if ( x >= 32 ) { x = x - 32; y = y + 100000; } if ( x >= 16 ) { x = x - 16; y = y + 10000; } if ( x >= 8 ) { x = x - 8; y = y + 1000; } if ( x >= 4 ) { x = x - 4; y = y + 100; } if ( x >= 2 ) { x = x - 2; y = y + 10; } if ( x >= 1 ) { x = x - 1; y = y + 1; } return y; } }
main
program.
Sat-Sun Feb 15-16
Fri Feb 14
Happy Valentine's Day!
Thu Feb 13
Wed Feb 12
Subject: Midterm One Dear A201/A597/I210 Friends, Midterm Exam is today Wed 2/12 7-9pm in Jordan Hall 124. Bring a No. 2 pencil and a picture ID with you. (Your picture ID). Exam is open book and open notes. You can rely on
Exam is individual work. Good luck and see you tonight. ... Adrian |
![]() Jordan Hall |
Tue Feb 11
1. Scott McCarthy ( slmccart@cs.indiana.edu
)2. Anastasiya Chagrova ( achagrov@cs.indiana.edu
)3. Reuben Wilson ( reujwils@cs.indiana.edu
)4. Steven Bogaerts ( sbogaert@cs.indiana.edu
)5. Andrew Strain ( ajstrain@cs.indiana.edu
)
Mon Feb 10
Sat-Sun Feb 8-9
Date: Sat, 8 Feb 2003 17:49:33 -0500 (EST) From: Adrian German <dgerman@cs.indiana.edu> To: A201 Spring 2003 Distr. ListSubject: A201 Distribution List Dear A201/A597/I210 Friends, I have finally created a distribution list and I am using it now to send a first message. I plan to use this list perhaps once a week to keep you informed of things that you might otherwise miss if posted on the web only. Please don't forget the four quizzes in QuizSite. Use your notes and the book and all the knowledge you have to solve all exercises. The exam on Wednesday will be composed of questions very much like the ones in the quizzes. Essentially identical in _structure_. The exam is open book, Wed Feb 12, 7-9pm in Jordan 124, bring a No. 2 pencil since the exam is (as expected, and as announced) multiple choice. Please write to me if you need help with the quizzes. Identify the problem by quiz and number and I will try to get back to you with a quick answer. On Monday I will try to collect a list of "difficult" questions from you (perhaps through QuizSite or by e-mail) so we can review especially those in class on Tuesday. Hope your weekend is coming along fine. If you need help please let me know. ... Adrian P.S. If you receive this message in error or if you don't want or don't need to be on this list please let me know and I will remove your username from the list. Thanks and all the best.
Fri Feb 7
The assignment is now due
tonight, Friday, in QuizSite (dgerman-Q201
).
QuizSite and Postem rosters updated throughout.
Please check and report any errors and/or omissions.
Thu Feb 6
Here they are for your review as part of the course packet: One Two Three Four.
Take them to learn (by experimentation and discovery), and not to test yourselves.
After you're done with them also study (to learn through it) this older test.
(It is the first midterm exam from Spring 2002 as administered then).
Wed Feb 5
The first Midterm Exam is next week in Jordan Hall Room 124 (7-9pm).
It's an open-book, multiple choice exam.
Check the
Tue Feb 4
)
Especially the quizzes are important.
Tue Feb 5
Mon Feb 3
The first midterm exam (next week) will be multiple choice.
Sun Feb 2
There's a set of lecture notes, and another one of lab notes and exercises.
Sat Feb 1
Reading assignments for next week will focus on:
A more detailed (page by page) reading assignment will be posted on
What's Due? (with icon)
Thu-Fri Jan 30-31
Wed Jan 29
A201-1216
) has been updated as well (on Wednesday). The style guide.
Tue Jan 28
Mon Jan 27
1. Anastasiya Chagrova ( achagrov@cs.indiana.edu
)2. Reuben Wilson ( reujwils@cs.indiana.edu
)3. Steven Bogaerts ( sbogaert@cs.indiana.edu
)4. Andrew Strain ( ajstrain@cs.indiana.edu
)
Sat-Sun Jan 25-26
We're now starting to write real programs (that solve actual problems)!
Fri Jan 24
Thu Jan 23
Also, Homework Assignment One has been posted.
(It's very similar to Lab Assignment Two).
Wed Jan 22
These are good people. Contact and make arrangements directly with them.
1. Reuben Wilson ( reujwils
)2. Steven Bogaerts ( sbogaert
)3. Andrew Strain ( ajstrain
)
Tue Jan 21
Alternatively, you can download
Emacs. (Here's a reference card
for Emacs, to help you use it more effectively).
Remember that no editor (or any Java IDE for that matter) is Java. What we
mean by Java is essentially encapsulated in two programs: javac
and java
. The rest is ancillary material related to development.
But Emacs is the superior editor!
(Emacs installation is a bit old, I will try to update it soon).
Sun-Mon Jan 19-20
Fri-Sat Jan 17-18
Wed-Thu Jan 15-16
Here are the most relevant steps (all of them):
Windows (all languages, including English) SDK (not JRE)
Alternatives to be described later are Dr. Java and Emacs.
Please contact me (dgerman@indiana.edu
) if you need more info.
Tue Jan 14
Mon Jan 13