Assignemnt #34 Space Boxing
Code
///Name: JJ Deng
///Period: 6
///Program Name: Space Boxing
///File Name: SpaceBoxing.java
///Date Finished: 10/22/15
import java.util.Scanner;
public class SpaceBoxing
{
public static void main( String[] args )
{
Scanner SB = new Scanner(System.in);
double weightU, weightE, V, M, J, S, U, N;
V = 0.78;
M = 0.39;
J = 2.65;
S = 1.17;
U = 1.05;
N = 1.23;
System.out.println("Please enter your current earth weight:");
weightE = SB.nextDouble();
System.out.println("I have information for the following planets:");
System.out.println(" 1. Venus 2. Mars 3. Jupiter");
System.out.println(" 4. Saturn 5. Uranus 6. Neptune");
System.out.println();
System.out.println("Which planet are you visiting?");
weightU = SB.nextDouble();
if ( weightU == 1 )
{
System.out.println("Your weight would be "+(weightE*V)+" pounds on that planet.");
}
else if ( weightU == 2 )
{
System.out.println("Your weight would be "+(weightE*M)+" pounds on that planet.");
}
else if ( weightU == 3 )
{
System.out.println("Your weight would be "+(weightE*J)+" pounds on that planet.");
}
else if ( weightU == 4 )
{
System.out.println("Your weight would be "+(weightE*S)+" pounds on that planet.");
}
else if ( weightU == 5 )
{
System.out.println("Your weight would be "+(weightE*U)+" pounds on that planet.");
}
else
{
System.out.println("Your weight would be "+(weightE*N)+" pounds on that planet.");
}
}
}
Picture of the output