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