• Post Reply Bookmark Topic Watch Topic
  • New Topic

My first program (not not written from a follow along exercise)  RSS feed

 
Greenhorn
Posts: 22
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, I'm going kind of slowly, but I'm trying to let what i learn sink in, so that i can better understand and remember it.  This is from the chapter 1 self test in a book I'm reading.  Feel free to critique.
"9. The moon’s gravity is about 17 percent that of earth’s. Write a program that computes your effective weight on the moon."

 
Sheriff
Posts: 22846
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the Java programming point of view, it looks pretty good to me. Consistent indentation, meaningful variable names: those are positives.

But it has a fault, namely that it doesn't satisfy the requirements. And that's a definite negative. Did you run it? Does the output for your lunar weight come out as 17% of your earth weight?
 
Nathan banks
Greenhorn
Posts: 22
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote: Does the output for your lunar weight come out as 17% of your earth weight?
  :eek: I thought it was supposed to be 17% less than earth weight!  Yikes, i better fix that!
 
Nathan banks
Greenhorn
Posts: 22
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
  Wow, 25.5lbs.  Now that is light!

Thanks Paul 
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!