Assignemnt #38

Code

/// Name: Sam Menar
/// Period: 6
/// Program Name: Space Boxing
/// File Name: SpaceBoxing.java
/// Date Finished: 10/27/2015

import java.util.Scanner;
public class SpaceBoxing
{
    public static void main( String[] args )
    {
        Scanner keyboard = new Scanner(System.in);
        
        int weight, planet;
        double newWeight=0;
        
        System.out.print( "Please enter your current earth weight: " );
        weight = keyboard.nextInt();
        
        System.out.println( " " );
        
        System.out.println( "I have information for the following planets:" );
        System.out.println( "\t1. Venus \t2. Mars \t3. Jupiter " );
        System.out.println( "\t4. Saturn \t5. Uranus \t6. Neptune " );
        
        System.out.println( " " );
        
        System.out.print( "Which planet are you visiting? " );
        planet = keyboard.nextInt();
        
        System.out.println( " " );
        
        if ( planet == 1 )
        {
            newWeight = weight * .78;
        }
        else if ( planet == 2 )
        {
            newWeight = weight * .39;
        }
        else if ( planet == 3 )
        {
            newWeight = weight * 2.65;
        }
        else if ( planet == 4 )
        {
            newWeight = weight * 1.17;
        }
        else if ( planet == 5 )
        {
            newWeight = weight * 1.05;
        }
        else if ( planet == 6 )
        {
            newWeight = weight * 1.23;
        }
        else
        {
            System.out.println( "error" );
        }
        
        System.out.print( "Your weight would be " + newWeight + "pounds on that planet." );
        
    }
}
        

    

Picture of the output

Assignment 13