Assignemnt #38 and Space Boxing
Code
/// Name: Tristan Chung
/// Period: 5
/// Program Name: Space Boxing
/// File Name: SpaceBoxing.java
/// Date Finished: 10/28/2015
import java.util.Scanner;
public class SpaceBoxing
{
public static void main( String[] args )
{
int weight, planet;
double w1;
Scanner keyboard = new Scanner(System.in);
System.out.print("Please enter your current earth weight to the nearest integer: ");
weight = keyboard.nextInt();
System.out.println("I have the 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.print("Which planet are you visiting? ");
planet = keyboard.nextInt();
System.out.println(" ");
if ( planet == 1 )
{
w1 = weight * .78;
System.out.println("Your weight would be " + w1 + " on that planet.");
}
else if ( planet == 2 )
{
w1 = weight * .39;
System.out.println("Your weight would be " + w1 + " on that planet.");
}
else if ( planet == 3 )
{
w1 = weight * 2.65;
System.out.println("Your weight would be " + w1 + " on that planet.");
}
else if ( planet == 4 )
{
w1 = weight * 1.17;
System.out.println("Your weight would be " + w1 + " on that planet.");
}
else if ( planet == 5 )
{
w1 = weight * 1.05;
System.out.println("Your weight would be " + w1 + " on that planet.");
}
else if ( planet == 6 )
{
w1 = weight * 1.23;
System.out.println("Your weight would be " + w1 + " on that planet.");
}
}
}
Picture of the output