Assignment 38: Space Boxing

Code

    /// Name: Ryan McAteer
    /// Period: 5
    /// Program Name: Space Boxing
    /// File Name: Assignment38.java
    /// Date Finished: 10/13/15

import java.util.Scanner;

class Assignment38 
{
      public static void main(String[] args) 
      {
           Scanner keyboard = new Scanner(System.in);
           
           int weight, planet;
           double planetWeight;
           
           System.out.println( "Please enter your current earth weight: " );
           weight = keyboard.nextInt();
           
           System.out.println( "I have information on the following planets: " );
           System.out.println( "    1. Venus  2. Mars   3. Jupiter " );
           System.out.println( "    4. Saturn 5. Uranus 6. Neptune " );
           System.out.println( "Which planet are you visiting? " );
           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 weight would be " + planetWeight + " pounds on that planet." );
      }
}
           
    

Picture of the output

This should work