James Chegwidden

+ Follow
since Oct 06, 2002
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by James Chegwidden

The 5th edition of a popular Java series from AWL...
16 years ago
Three MC questions came from a test bank in a java book- that I think are wrong but I wanted your take on them and see if I am wrong...


Based on the code above, if the value of y is found to be 2, what is a possible value of x? B

The answer key says B I say A

Given the following switch statement where x is an int:

If x is currently equal to 5, what will the value of x be after the switch statement executes?

The answer says 7 but I test this program I got 11...


#3 How many times will the following loop iterate?


The answer key says D I ran this I got C 10

Now am I going crazy or all or did this Java author get these questions- blantanty wrong- or is it me..Thanks JC
16 years ago
First, my C++ compiler is on my Office machine not Java (java is on other computers) so the code below is in C++ but the question I have is relevent in Java as well...

Divisibility test here 3 & 9

Now it works just fine however, my student are doing this (Getting the same answers)


1. Why do I see books use the first solution when the second is shorter and give the same answer.
2. What is the point of all of those "tests" when the second solution appears to always work.
3. Were would the second solution fail? I want them to do the first solution not the second...

Move to appropriate forum if needed. jc
16 years ago

What did you use instead?

Actually I went back to a swing based unicode and the first set worked. Thanks...
17 years ago
Nevermind I got it...wrong Unicode values
17 years ago
I want to print out the ASCII/unicode representation of hearts, clubs, spades and diamonds

instead of saying with strings...
String suits[] = { "Hearts", "Diamonds", "Clubs", "Spades" };
I tried this

String suits[] = { "\u2665", "\u2666", "\u2663", "\u2660" };

when printing I got a ?


I noticed this...string.toUpperCase()
my unicode is rusty...
17 years ago

The students are first year students at university. They learn basic programming concepts in Java (linked lists, doubly linked lists, generics, Queues, exceptions, etc). Every week they learn something new.

Wow pretty advanced for beginning Java student- except with AP CS...

Look at Head first Java- good ideas there...
17 years ago
Got a copy of the new head first OO book...

Question on Class Diagram in particular Interfaces and representation.

In UML 2.0 reference books Interface methods/attributes are not italics

in particular in Learning 2.0 and other UML references in basically says.."..unlike abstract classes, an interface does not have to show that its operations are not implemented, so it does not have to use italics."...

But in Head First OO (p. 224 and others) and in other Java programming books...Interfaces are italicized in UML..


1. Why the incosistencies?
2. Which is correct- italic or non italics...or is it optional and if so why not say so- instead say one way or other...

I thought this question was answersd a while back but there seems to be inconsistent in notation..jc
Is the combination of FileInputStream/FileOutputStream with DataInputStream/DataInputStream still the prefered way to teach Binary Files in Java 5.

Some books use File class since it handles both text and binary files- but it add another layer of chaining:

Could a DataOutputStream directly handle the File class:

Haven't tryed it yet- asking for opinions about the Binary Files at this point..Thanks JC
17 years ago
Remember these:
With %, the result of m % n is always less than the divisor n. To calculate m % n with integers m and n:

m % n == m - (m / n) * n

Modulus Operator Shortcuts:

Ignore the signs of the operands, calculate the remainder, and negate the remainder if the dividend (first number) is negative

Thus, with modulus the result is the same sign of the dividend.

If the dividend is smaller than the divisor, the result will be the dividend

17 years ago

Why would they not let you use the HFJ in your class. I use it as an optional book.

Just curious you have no say in what book you teach out of...
17 years ago
There is a published article/newletter called "The Teaching Professor" for college and university instructors. They have different articles from over certain ideas some that would be an interesting read would be.

"Working in Groups- Understanding but not Applying"
"10 Worthwhile Considerations for Improving Lectures"

"The Effects of Instructional Methods on Student Learning"

"Students Formulating Their Own Exam Questions"

"Contract Grading Options Reveal Level of Student Involvement"

And for Bert:

"Motivating Students: 8 Simple Rules for Teachers"

"How Faculty Learn to Teach Better"

"An Eloquent, Insightful Teaching Philosophy Statement"

"What Motivates Students?"

"What Does it Mean to "Make a Difference" in Students' Lives"

From Innovation Abstracts:

"Pop tests: Valuable Instructional Tools"

Finally From Elder & Paul

"How to Improve Student Learning 30 Practical Ideas"
"The Foundations of Analytical Thinking"

I have all of these scaned in as PDF..Let me know if any of you would be interested in any of these JC
17 years ago

Are you teaching Advanced Placement Computer Science in your high school?
Also, is this your first time ever teaching high school programming?

17 years ago
Jim answered my question CR.

I know what Scanner is and have taught Scanner for files/console I/O for two semesters now..Just asking for opinion- since it is not consistent in Java Programming texts (1.5)

Oh and it is Malik that uses this:

Scanner inFile = new Scanner(new FileReader(filename));

Others use the File Class...
17 years ago
I have been noticing a in new Java textbook editions- the use of Scanner with Text Files. However, there seems to be not a consensus in the books on what classes to use with Scanner with reading text files. Some use the File Class in tandem with Scanner others use FileReader and Scanner together.

Which classes do you Java professionals/users tend to use with text files..Give me a better direction on teaching files

17 years ago