diff --git a/6-methods/31-earths-moon.java b/6-methods/31-earths-moon.java index 0815abb..366b877 100644 --- a/6-methods/31-earths-moon.java +++ b/6-methods/31-earths-moon.java @@ -3,21 +3,15 @@ public class HelloWorld { - public static double earthMoonWeight(String name, int weight, String unit) { + public static void earthMoonWeight(String name, int weight, String unit){ - double moonWeight = weight * (1.62 / 9.81); - return moonWeight; + double weightOnMoon = weight * (1.62 / 9.81); + String message = "Hi " + name + "! Your weight on Earth is " + weight + " and your weight on the moon would be about " + weightOnMoon + unit +". "; + System.out.println(message); } public static void main(String[] args) { - - String name = "Max"; - int earthWeight = 30; - String unit = "lbs"; - double moonWeight = earthMoonWeight(name, earthWeight, unit); - - System.out.println("Hi " + name + "! Your weight on Earth is " + earthWeight + unit + - " and your weight on the moon would be about " + moonWeight + unit + "."); + earthMoonWeight("Max",30,"lbs"); } }