I am trying to write some code to practice using methods. My goal is to get the user to input their weight. Then in the method I want to convert the earth weight to moon weight, which is earth weight / 6. I think I got it but I can get the results to come back to the main class. Any idea what I am missing here?
import java.util.Scanner;
public class EarthWeight {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Lets find out what your weight on the moon is?");
System.out.println("Enter your weight on earth here:");
double earthweight = input.nextDouble();
WeightConverter WeightConverterObject = new WeightConverter();
WeightConverterObject.moonweight(moonweight);
System.out.println("Your earth weight it " + earthweight);
System.out.println("\nYour moon weight it " + moonweight);
}
}
The second class, where the conversion takes place looks like this.
public class WeightConverter {
public double moonweight(double earthweight, double moonweight){
return moonweight = earthweight / 6;
}
}