Date: Tue, 11 Feb 2003 13:06:47 (CST) From: Mark Jacobson To: 810-061-02@uni.edu Subject: Laundry Sorter due Friday by 5 p.m. Hi Java students (11 TTh), The Laundry Sorter program will be extended so that you can turn it in by Friday afternoon at 5 p.m. (Friday, February 14th). That way, if you do not have it done by classtime on Thursday, you can still have another 30 hours until it is due. I can talk about any further problems you are having and you can get another 75 minutes of Java discussion behind you. One example you will see on Thursday that is the last feature you might need some help with for Laundry Sorter is: How to have counters in a program: The Laundry Sorter program counts: Correct placements: 12 Incorrect placements: 5 so counters concepts and techniques will be discussed on Thursday. You would have a correctCount and an incorrectCount variable, each initialized to 0 (ZERO) in the begin() method. Somewhere in your program, probably in the onMouseRelease() event, you would have correctCount = correctCount + 1; and incorrectCount = incorrectCount + 1; statements, protected by if or else or else if conditions. Or have correctCount++; and incorrectCount++; would be okay too. Assume n is an int variable: int n; Initialize n to value ZERO with: n = 0; In Java the statement: n = n + 1; increments variable n, i.e. adds 1 to its value. Adding 1 is called counting or incrementing. In Java and C and PERL and C++ we can also write n++; when we wish to increment the variable n. n++; is identical in effect to n = n + 1; I will try to put an applet version of today's class example, the divide by 2, divide by 3 and remainder (mod 2 and mod 3) practice program, on the class web page later today. URL: http://www.cns.uni.edu/~jacobson/061 See you in class on Thursday. Mark ------------------------------------------------------------------ The Laundry Sorter program will be extended so that you can turn it in by Friday afternoon at 5 p.m. (Friday, February 14th). ------------------------------------------------------------------