Assignment #38 and Space Boxing
Code
/// Name: Ali Kurland
/// Period: 6
/// Program Name: Space Boxing
/// File Name: SpaceBoxing.java
/// Date Finished: 9/24/2015
import java.util.Scanner;
public class SpaceBoxing
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
int weight;
int planet;
System.out.print( "Please enter your current earth weight: " );
weight = keyboard.nextInt();
System.out.println( "I have information for the following planets:" );
System.out.println( "\t 1. Venus \t 2. Mars \t 3.Jupiter" );
System.out.println( "\t 4. Saturn \t 5. Uranus \t 6. Neptune" );
System.out.print( "Which planet will you be visiting? " );
planet = keyboard.nextInt();
if ( planet == 1 )
{
System.out.println( "Your weight would be " + (weight * 0.78) + " pounds on that planet." );
}
else if ( planet == 2 )
{
System.out.println( "Your weight would be " + (weight * 0.39) + " pounds on that planet." );
}
else if ( planet == 3 )
{
System.out.println( "Your weight would be " + (weight * 2.65) + " pounds on that planet." );
}
else if ( planet == 4 )
{
System.out.println( "Your weight would be " + (weight * 1.17) + " pounds on that planet." );
}
else if ( planet == 5 )
{
System.out.println( "Your weight would be " + (weight * 1.05) + " pounds on that planet." );
}
else if ( planet == 6 )
{
System.out.println( "Your weight would be " + (weight * 1.23) + " pounds on that planet." );
}
else
{
System.out.println( "error" );
}
}
}
Picture of the output