Also, this is a great link. I need to commit to memory more of what I read. I have visited this page before, but that was about a week ago. As I continue to learn more I should revisit pages like this so that I can be sure I am doing everything correctly. For example, my books exercises do not have the keyword for followed by a space Thanks againGanesh Patekar wrote:
Good to read click here --->Java Programming Style Guide
Oh, okay. I didn't know you could assign a comment statement. I'll check out the link. Thanks!Ganesh Patekar wrote:No no you are just writing comment but not commenting assignment statement counter = 0; on line no 5.
I did run it again and I got the expected results from the exercise. Maybe I'm misunderstanding what you're asking me to try. I inserted the comment after I gave counter a value of 0 I will study the link you gave me more tomorrow (its late now) and I thank you. You cleared up a lot!Ganesh Patekar wrote:Are you sure? I'm talking about commenting counter = 0 on line no 5.. verify again.
Julian West wrote:
- Indent! heh
- You can just use gallons as a counter and ditch the counter logic; use gallons % 10 (modulus operator) instead
- You can use printf or String.format to format your numbers to a fixed size and spacing
- You can make gallons an int and you can declare it in the For loop
- You can declare litres in the for loop since it isn't used outside the loop
Is the block (i think its a block) containing counter++ part of the loop. If I assigned counter a value one line before counter++ does that make it part of the loop? Also, the program ran without errors with and without the comment // counter = 0Ganesh Patekar wrote:You can initialize counter in loop Or outside loop doesn't matter, just need to initialize before It's use. But If you initialize counter in loop then each time loop executes It'll again assign same value to counter.
Hey, Thanks! My first cow! The JavaRanch has already been very inspiring to me, so I'm glad to have any sort of meaningful impact here.Jeanne Boyarsky wrote:Welcome Nathan. Have a cow for being the post that inspired a new users introductions forum.
:eek: I thought it was supposed to be 17% less than earth weight! Yikes, i better fix that!Paul Clapham wrote: Does the output for your lunar weight come out as 17% of your earth weight?
Hey, that's terrific! Thank you for even more helpful info. I'm really glad I decided early on to sing up for an account and dive into the forums. It's out of character for me, but I'm happy here already.Campbell Ritchie wrote:No, it won't. If it takes longer, that is because you are using the wrong text editor. The suggestions in this post will allow you to use a text editor to code more quickly and to find formatting errors more easily.
Ganesh Patekar wrote:Nathan, Worth reading click here -->Java Programming Style Guide
I thought was what i read. I wasn't sure if you were trying to test me/see if I would catch it when you wrote:Liutauras Vilda wrote:One more thing. Variable names if these aren't constants (forget about those for a while) suppose to start with a lower case (this is how the Java coding convention states).
I actually tried it both ways (probably more like 6 ways until I got it to run right.) I figured I would post the results with "Nathan", but I am now more clear on the convention.Liutauras Vilda wrote:For instance JavaScript:
[code=javascript]var name = "Nathan";
Liutauras Vilda wrote:One thing, I'd suggest not to use such variable name as "var", because in some other programming languages it is an identifier to declare a variable.
Liutauras Vilda wrote: