Interplanetary weight calculator I have been using this site for a couple of years for great answers and a ton of help. I wrote this program for my class project due 1/23. I am just wondering what you would recommend me changing or improving. I think I have some repetitive code, but I have not learned about defs in Java yet. 

package project2;

import java.util.Scanner;

/**
 * @author Sartaj Singh
*/
public class Project2 {

    public static void main(String[] args) {

        int choice = 0;
        double weight;
        double earth = 9.81;
        double moon = 1.622;
        double mercury = 3.7;
        double venus = 8.87;
        double jupiter = 24.79;

        System.out.println("Welcome to Planetary Weight Calculator: ");
        Scanner input = new Scanner(System.in);
        System.out.print("Enter your weight in pounds (lb): ");
        weight = input.nextDouble();
        while (weight &lt;= 0) {
            System.out.println("Invalid Input - Plase enter a value higher than 0 ");
            System.out.print("Enter your weight in pounds (lb): ");
            weight = input.nextDouble();
        }
        System.out.println("/////MENU/////");
        System.out.println("1 - Moon");
        System.out.println("2 - Mercury");
        System.out.println("3 - Venus");
        System.out.println("4 - Jupiter");
        System.out.print("Pick a number 1-4: ");
        choice = input.nextInt();
        while (choice &lt;= 0 || choice &gt;= 5) {
            System.out.println("/////MENU/////");
            System.out.println("1 - Moon");
            System.out.println("2 - Mercury");
            System.out.println("3 - Venus");
            System.out.println("4 - Jupiter");
            System.out.print("Pick a number 1-4: ");
            choice = input.nextInt();
        }
        switch (choice) {
            case 1:
                System.out.println("You selected Moon, your weight on Moon is: ");
                System.out.println(weight * (moon / earth) + " Lbs");
                break;
            case 2:
                System.out.println("You selected Mercury, your weight on Mercury is: ");
                System.out.println(weight * (mercury / earth) + " Lbs");
                break;
            case 3:
                System.out.println("You selected Venus, your weight on Venus is: ");
                System.out.println(weight * (venus / earth) + " Lbs");
                break;
            case 4:
                System.out.println("You selected Jupiter, your weight on Jupiter is: ");
                System.out.println(weight * (jupiter / earth) + " Lbs");
                break;
        }

        System.out.println("Thank you for using the Planetary Weight Calculator");
        System.out.println("Hope you will use it again! ");

    }

}
I would create a class for the Planets for a more scalable and Object Oriented design, as detailed below


The class would store Earth's G in a constant, because it does not change in any planet's calculation. 
The constructor should require the planet's own G value and it's name (for the Print statements, discussed further below).
You can also add a method to calculate the resultant weight based on a given weight value, to follow along with the Object Oriented approach.

public class Planet {

final double earthG = 9.81;
double myG;
public String planetName;

public Planet(String planetName, double myG){
    this.myG = myG;
    this.planetName = planetName;
}

public double calculateWeight(double weight){
    return weight * myG/earthG;
}
}



In the main method I would create an array of Planets for readability,

Planet[] planets = new Planet[]{new Planet("Moon", 1.622),
                                new Planet("Mercury", 3.7),
                                new Planet("Venus", 8.87),
                                new Planet("Jupiter", 24.79)};


And use a Do-While loop to populate the loop instead of the While loop. The Do-While checks for the condition at the end, so the first print doesn't requires an input.

do{
   ...
  } while(expression);


You can also use the array to populate the menu itself using for loop. This is especially helpful if you have a large number of planets/items in the array.

do {
    System.out.println("/////MENU/////");
    for(int i=0;i&lt;planets.length;i++){
        System.out.println(i + " - " + planets[i].planetName);
       }
    System.out.print("Pick a number 0 - " + planets.length + ": ");
    choice = input.nextInt();
    } while (choice &lt;= 0 || choice &gt;= 5);


Using the array has a massive advantage here for the output statement. Since the choice corresponds to the planet's position in the array, you can simply call the appropriate planet's method as planets[choice].calculateWeight(weight). Following two lines will suffice the purpose of the previous Switch-Case.

System.out.println("You selected " + planets[choice].planetName + ", your weight on " + planets[choice].planetName + " is: ");
System.out.println(planets[choice].calculateWeight(weight) + " Lbs");