Douglas Knapp

Ranch Hand
+ Follow
since Feb 14, 2012
Douglas likes ...
IntelliJ IDE Eclipse IDE VI Editor
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
14
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Douglas Knapp

OK, I think three days is long enough. Being a beginner myself, I thought I'd throw my two cents in. This is the solution I came up with:



NOTE: I am assuming that the bottom of the rectangle is parallel to the x axis.
3 years ago
Junilu,
You are correct, sir. Mr. Schildt did have another indent for lines 7 through 11. That was my mistake transcribing from the book. It does not detract from my point however. Braces on that for would have made the program that much more readable.
3 years ago
I've been trying to make myself follow the CodeRanch style guide. I think it's improving the consistency and readability in my code.

This bit is right at the top. I ran into a situation last night that I think really validates it.

Section 1.1 - Indentation

//...
All if, while and for statements must use braces even if they control just one statement.i]

I'm working my way through Schildt's [i]Java A Beginner's Guide.
The exercise is on nested loops.

His code:


The issue I ran into is that I was confused as to where the println() statement fell. I thought that it fell inside the loop.

That's where this line in the guide comes into play. If Mr. Schildt had put braces in his for loop, it would have been obvious where the println() method fell.

This is how I wrote it:


Of course, writing this post has me rereading the guide and seeing things I missed before. I think I'm going to have to spend a little of my study time on it.
3 years ago
I'll check it out, Pete.
3 years ago
Thank you, Pete.

I'm going to bookmark this thread, rather than the guide itself.

And... having not looked at those links yet, is it possible to install the CodeRanch style guide settings?
3 years ago
I just ran into a situation this morning that I think really validates a point in the style guide here at the ranch. I was going to post about it, but wanted to consult the style guide again, but I find I didn't bookmark it. Now, Ican't find the durned thing.

Can someone post a link, please?

Thanks,
doug
3 years ago
Frankie,
First, welcome to the Ranch.

Second, all you got, I think, is the JRE, Java Runtime Environment. I don't think java.com will get you to the JDK. Try this site:

http://www.oracle.com/technetwork/java/javase/downloads/index.html

(Which I know works, because I was just there.)

Have a great night,
Doug
3 years ago
Paul,
That helps immensely. You'll be getting some of my hard earned ducats for those plans. I wish I could build my own anvil.

Thanks,
Doug
3 years ago
Paul,
Can I get the TL;DR version? I want to know if I can get the plans for a rocket oven like yours. What caught my ear was the phrase "fifteen-hundred degrees." I'm thinking that this, or a variant, may actually make a good forge.

Thanks,
Doug
3 years ago


The Franklin Ace 1000, a clone of the Apple II Plus.

On which, I used to play the original Prince of Persia.

Of course, I played it in monochrome amber.
3 years ago
Carey,
I've found this whole site to be quite handy. Y'all are some of these easiest people to poke with questions. The only place to come within a lightyear is Linux Questions. Their Programming forum is generally quite welcoming to the inexperienced, as long as it's not obviously your homework.
3 years ago

Carey Brown wrote:And, if you jump down the rabbit hole, this is a way to do it using Java-8 Streams.



Carey,
I plan on diving down the rabbit hole. I want to see how deep it goes. I finished one beginner's book, Burd's Beginning Programming with Java for Dummies. I started to go in two different directions after that. First, I thought Learn JavaFX 8, because that is something I want to learn, but I ran into lambdas, and I wanted to really understand what I was doing. So, I put that on hold, and thought that Boyarsky's  OCA: Oracle Certified Associate Java SE 8 Programmer I Study Guide might be a good second step. Basically, ran into a similar issue. So, deciding that I wasn't quite ready to move out of stage one, I started Schildt's Java A Beginner's Guide. Which is where I found the WhileDemo that I decided to play with to wrap my head around continue.

So, now I'm right where Campbell is talking about, break statements and labels. I'm fighting with one right now. I type it out, and I get the error that some of the code is unreachable. I copy and paste the code, (note: this is not how I roll. I like to type it all out), and no errors. I'm not ready to come begging just yet. I like to realize my own mistakes, if I can.

As for that code you posted. I like it for being concise. I've run into Streams a bit, but nothing in-depth, as yet.
3 years ago
That is better. I won't claim I would have thought of it, but this whole topic started when I took the WhileDemo from Schildt's Java A Beginner's Guide and tweaked it to use continue. I wanted to play with it, to see it work.

Carey Brown wrote:

3 years ago