Assignemnt #38 and Space Boxing
Code
///Name: Daniel Tiffany-Appleton
///Period: 7
///Program Name: Space Boxing
///File Name: SpaceBoxing
///Date Finished: 10/7/15
import java.util.Scanner;
public class SpaceBoxing
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
double venusWeight, marsWeight, jupiterWeight, saturnWeight, uranusWeight, neptuneWeight;
int earthWeight, planetChose;
System.out.print( "Please enter your current earth weight: " );
earthWeight = keyboard.nextInt();
venusWeight = earthWeight * .904;
marsWeight = earthWeight * .39;
jupiterWeight = earthWeight * 2.53;
saturnWeight = earthWeight * 1.06;
uranusWeight = earthWeight * .886;
neptuneWeight = earthWeight * 1.13;
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.print( "Which planet are you visiting? " );
planetChose = keyboard.nextInt();
if ( planetChose == 1 )
{
System.out.println( "Your weight would be " + venusWeight + " pounds on that planet." );
}
else if( planetChose == 2 )
{
System.out.println( "Your weight would be " + marsWeight + " pounds on that planet." );
}
else if( planetChose == 3 )
{
System.out.println( "Your weight would be " + jupiterWeight + " pounds on that planet." );
}
else if( planetChose == 4 )
{
System.out.println( "Your weight would be " + saturnWeight + " pounds on that planet." );
}
else if( planetChose == 5 )
{
System.out.println( "Your weight would be " + uranusWeight + " pounds on that planet." );
}
else if( planetChose == 6 )
{
System.out.println( "Your weight would be " + neptuneWeight + " pounds on that planet." );
}
}
}
Picture of the output