Assignemnt #38: Space Boxing
Code
/// Name: Cassie
/// Period: 6
/// 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 )
{
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( "I have information for th 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();
if ( planet == 1 )
{
System.out.println( "Your weight would be " + ( weight * .91 ) + " pounds on Venus." );
}
if ( planet == 2 )
{
System.out.println( "Your weight would be " + ( weight * .38 ) + " pounds on Mars." );
}
if ( planet == 3 )
{
System.out.println( "Your weight would be " + ( weight * 2.36 ) + " pounds on Jupiter." );
}
if ( planet == 4 )
{
System.out.println( "Your weight would be " + ( weight * .91 ) + " pounds on Saturn." );
}
if ( planet == 5 )
{
System.out.println( "Your weight would be " + ( weight * .89 ) + " pounds on Uranus." );
}
if ( planet == 6 )
{
System.out.println( "Your weight would be " + ( weight * 1.12 ) + " pounds on Neptune." );
}
}
}
Picture of the output