Assignment #38 and Space Boxing
Code
/// Name: Tim Chuang
/// Period: 7
/// Program Name: Space Boxing
/// File Name: SpaceBoxing.java
/// Date Finished: 11/10/2015
import java.util.Scanner;
class SpaceBoxing
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
int weight, planet;
double planetWeight;
System.out.println( " How much do u weigh: " );
weight = keyboard.nextInt();
System.out.println( "U can go to these places: " );
System.out.println( " 1. Venus 2. Mars 3. Jupiter " );
System.out.println( " 4. Saturn 5. Uranus 6. Neptune " );
System.out.println( " Where are u going? " );
planet = keyboard.nextInt();
if ( planet == 1 )
{
planetWeight = weight * .78;
}
else if ( planet == 2 )
{
planetWeight = weight * .39;
}
else if ( planet == 3 )
{
planetWeight = weight * 2.65;
}
else if ( planet == 4 )
{
planetWeight = weight * 1.17;
}
else if ( planet == 5 )
{
planetWeight = weight * 1.05;
}
else if ( planet == 6 )
{
planetWeight = weight * 1.23;
}
else
{
planetWeight = weight;
}
System.out.println( "Your weigh " + planetWeight + " pounds on that planet. You fat. " );
}
}
Picture of the output