This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
I tested this code on my computer and it works. Please note that I had to use Locale.CANADA because in my country we use a comma "," for doubles and nf.format only takes a dot "." .
Let me know if it works on your computer.
As you will see from the top of the Beginning Java forum, we believe that people do not learn from being given complete answers straight off: it says this, which somebody else has already drawn to your attention.
We're all here to learn, so when responding to others, please focus on helping them discover their own solutions, instead of simply providing answers.
Jeff has done right to remove the whole solution, as you have already been told. I do not believe anybody has done anything wrong to you.
Joined: Nov 27, 2010
Well, in schools providing a direct answer is called 'cheating'. In real life however, it's called 'collaboration'. There is something really wrong with our current education system. Pioneers like Khanacademy and RSA Animate are revolutionizing the way we think. I for one am a firm follower of them and I do not believe that we should decide how others learn or not. Instead of isolating everyone - we should collaborate. We should provide and compare answers, not hide them. Please watch this video for more information on this concept, as it is very valuable to today's intellectual development: http://www.youtube.com/watch?v=zDZFcDGpL4U
I absolutely agree that we should be collaborating - this is exactly why the rule exists - but I think you're missing an important distinction. If someone says "I don't understand this", and you explain to them how it works, that is collaboration and it's very effective. If you can lead someone in the right direction, and help them come to a solution, that's collaborating. But someone says "I need something that does this", and you give them something that they can apply without thinking, then they haven't had to engage and they've potentially learned nothing. That's not collaboration, because you are doing the work, not them. We're aiming for something different, and this site has been successfully helping people get a deeper understanding of programming for over a decade using this approach.
Joined: Nov 27, 2010
Over the years I have learned to program better by learning from other people's code. Therefor I believe in seeing other people's solutions. It helps a lot.
A classic example of this is when you first start learning HTML. You can learn by example. You start looking at other websites and scrolling through their code to see what constructs they used.
This is very helpful.
Another example is my years at university: 278 out of 300 students fail an economics course because the professor does things in a didactically incorrect manner - he provides a course where parts of it are not filled in.
This is absolutely horrible. Many students (especially the ones in the back of the aula) can't fully understand what the professor is saying at high speed. Even worse, sometimes they weren't able to hear what he said because annoying co-students in the middle row were being too loud. What's the result? You get students with a half empty book because of the previous reasons. Also, even if they filled it in, they didn't understand much of it. No one taught them why they were writing what they were. I've been in this situation and I decided to take a personal professor at home. He gave me all the answers straight up - full papers of answers and alternatives. I learned more of that in two days than I learned in an entire semester. So yes, I do believe in answers. What's even more: I went from an F grade to a B+ grade using that method. Why? I finally understood what I was doing and I was not being kept away from answers. I learned a lot more. In fact, now I fully understand economics.
Regarding the concerned thread though - I think Jeff shouldn't have been condescending ànd offensive to Lim by saying "I've been programming professionally for possibly longer than you've been alive". This is a personal insult towards Lim and it has nothing to do with that topic. If this is truly a forum of a 'friendly bunch', then people should stop being self-righteous and condescending like most programmers tend to be. If I help others, I speak in their context, in their world, in their words. I don't add my personal life to it and I don't bring down the person by acting like a narcissist know-it-all.
You have some interesting ideas on how a web site should be run. Those ideas are different from mine. I suggest that you start a new web site that is run the way you think is best. If you are right, all of the people on CodeRanch will prefer your side and CodeRanch will become a ghost town.
In the mean time: yes, your approach is a way. I understand what you are suggesting. And I still think my way is better.