Assignemnt #38 Space Boxing
Code
///Name: Prooz Fereydouni
///Period: 7
///Project Name: Space Boxing
///File Name: SB.java
///Date: 10/26/2015
import java.util.Scanner;
public class SB
{
public static void main( String[] args)
{
Scanner keyboard = new Scanner(System.in);
int planet;
double weight;
String planetName = "";
System.out.println( "Please enter your current earth weight: ");
weight = keyboard.nextInt();
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.println( "" );
System.out.println( "Which planet are you visiting?");
planet = keyboard.nextInt();
System.out.println( "" );
if (planet == 1 )
{
weight = weight * 0.78;
planetName = "Venus";
}
if (planet == 2 )
{
weight = weight * 0.39;
planetName = "Mars";
}
if (planet == 3 )
{
weight = weight * 2.65;
planetName = "Jupiter";
}
if (planet == 4 )
{
weight = weight * 1.17;
planetName = "Saturn";
}
if (planet == 5 )
{
weight = weight * 1.05;
planetName = "Uranus";
}
if (planet == 6 )
{
weight = weight * 1.23;
planetName = "Neptune";
}
System.out.println( "Your weight would be " + weight + " pounds on " + planetName + "." );
}
}
Picture of the output