Assignemnt 38 and Space Boxing
Code
/// Name: Xinting Chen
/// Period: 5
/// Program Name: Space Boxing
/// File Name: SpaceBoxing.java
/// Date Finished: 10/27/2015
import java.util.Scanner;
public class SpaceBoxing
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
double weightEarth, planet, 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.print( "Please enter your current earth weight: ");
weightEarth = keyboard.nextDouble();
System.out.println();
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.print("Which planet are you visiting?");
planet = keyboard.nextDouble();
if (planet == 1)
{
System.out.println("Your weight would be " + (weightEarth*V)+"pounds on that planet.");
}
else if (planet == 2)
{
System.out.println("Your weight would be " + (weightEarth*M)+"pounds on that planet.");
}
else if (planet == 3)
{
System.out.println("Your weight would be " + (weightEarth*J)+"pounds on that planet.");
}
else if (planet == 4)
{
System.out.println("Your weight would be " + (weightEarth*S)+"pounds on that planet.");
}
else if (planet == 5)
{
System.out.println("Your weight would be " + (weightEarth*U)+"pounds on that planet.");
}
else if (planet == 6)
{
System.out.println("Your weight would be " + (weightEarth*N)+"pounds on that planet.");
}
}
}
Picture of the output