Win a copy of Securing DevOps this week in the Security forum!

James Chegwidden

Author
Ranch Hand
+ Follow
since Oct 06, 2002
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
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...
10 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...

#1


Based on the code above, if the value of y is found to be 2, what is a possible value of x? B
A.2C.5
B.3D.6

The answer key says B I say A

#2
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?
A.5C.7
B.6D.10

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

Finally

#3 How many times will the following loop iterate?


A.0C.10
B.1D.11

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



Question:

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
10 years ago

What did you use instead?



Actually I went back to a swing based unicode and the first set worked. Thanks...
11 years ago
Nevermind I got it...wrong Unicode values
11 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 ?

http://www.fileformat.info/info/unicode/char/2660/index.htm

I noticed this...string.toUpperCase()
my unicode is rusty...
11 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...
11 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..

Questions.

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

JC
11 years ago
Marc,

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...
11 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
11 years ago
Sara,

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

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

JC
11 years ago