Assignment #38 and Space Boxing
Code
///Name: Tim Gibson
///Period: 6
///Project Name: Space Boxing
///File Name: SpaceBoxing.java
///Date Finished: 10/2/15
import java.util.Scanner;
public class SpaceBoxing
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
double weight;
int planet;
System.out.print( "Please enter your current earth weight: " );
weight = keyboard.nextDouble();
System.out.println( "\nI have information for the following planets:" );
System.out.println( "\t1. Venus 2. Mars 3. Jupiter" );
System.out.println( "\t4. Saturn 5. Uranus 6. Neptune");
System.out.print( "\n\nWhich planet are you visiting? " );
planet = keyboard.nextInt();
if ( planet < 2 )
{
weight = weight * 0.78;
}
else if ( planet < 3 )
{
weight = weight * .39;
}
else if ( planet < 4 )
{
weight = weight * 2.65;
}
else if ( planet < 5 )
{
weight = weight * 1.17;
}
else if ( planet < 6 )
{
weight = weight * 1.05;
}
else
{
weight = weight * 1.23;
}
System.out.println( "\nYour weight would be " + weight + " pounds on that planet." );
}
}
Picture of the output