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