Assignment #2

Chapter 3
3.9 Exercises
Question #12

Your weight is actually the amount of gravitational attraction exerted on you by the earth. Since the moon's gravity is only 1/6 of the earth's gravity, on the moon you would weigh only 1/6th of what you weigh on earth.

Write an application that inputs the user's weight and outputs his/her weight on Mercury, Venus, Jupiter and Saturn. Use the Values in the table below:
 
 

Planet
Multiply the Earth Weight by:
Mercury
0.4
Venus
0.9
Jupiter
2.5
Saturn
1.1

It must create a class file named "assign2.class". Use the javabook package. You will need to use the InputBox, OutputBox and MainWindow classes.
Note: you will need to declare variables of type "float" to perform your calculations with and use the getFloat method of InputBox.  The output should be formatted as follows:

Planet        Your Weight:
--------------------------
Earth            200. kgs
Mercury          80. kgs
Venus            180. kgs
Jupiter          500. kgs
Saturn           220. kgs

and, Yes I do want the line of dashes under the column headings...

Use the following method to limit the decimals to 2 places:

Math.round(earthwieght * multiplier * 100f) / 100f;