programming forums Java Java JSRs Mobile Certification Databases Caching Books Engineering OS Languages Paradigms IDEs Build Tools Frameworks Products This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Sheriffs:
Saloon Keepers:
Bartenders:

# homework help professor has me confused

web Wilson
Greenhorn
Posts: 4
So we are working on making our own classes and one of them was making a class to later be used in a weight converter on other planets (mainly the Moon, Mercury, Venus, Jupiter and Saturn) I have managed to make the class (code below)

but he added the rule "In this WeightCalculator class, I expect you to use each method you created at least once. " I asked him how I go about it and after a 30 minute talk i'm more confused then before after he mentioned I can take my mutator and just manipulate that here is what I have currently and it works so far

I'm just stuck what he means by using each method once.

Guillermo Ishi
Ranch Hand
Posts: 789
web Wilson wrote:
but he added the rule "In this WeightCalculator class, I expect you to use each method you created at least once. " I asked him how I go about it and after a 30 minute talk i'm more confused...
I'm just stuck what he means by using each method once.

If you don't use a method "at least once", just delete the method )))) Not a hard thing to handle.

I think the main thing for this assignment will be to multiply the weight by some factor like :

On the Moon you weigh 1/6 if I remember right. You just need the factor for each planet. Or calculate it using the mass of the planet. I guess it would be weight = weight * (mass of planet / mass of mother Earth)

Matthew Brown
Bartender
Posts: 4568
9
Guillermo Ishi wrote:Or calculate it using the mass of the planet. I guess it would be weight = weight * (mass of planet / mass of mother Earth)

Not a programming comment, but a physics one: this isn't correct! Or rather, it would only be correct for planets of different masses but the same size. You have to factor in that gravity is weaker further away from the centre, and so the radius matters as well. For planets of the same density, the strength of gravity at the surface is proportional to the radius. You're roughly correct about the strength of gravity on the moon, but the Earth has a mass that is a lot more than 6 times greater!

Guillermo Ishi
Ranch Hand
Posts: 789
Hmm. "...inversely proportional to the square of the distance between them." So maybe what I wrote over r^2. Check a couple of known examples to test that. All you need is the first column of this:
http://en.wikipedia.org/wiki/Gravity_of_Earth#Comparative_gravities_of_the_Earth.2C_Sun.2C_Moon.2C_and_planets

 With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.