Assignemnt #34

Code

  /// Name: Sam Wilson
  /// Period: 6
  /// Program Name: spacebox
  /// File Name: spacebox.java
  /// Date Finished: 10/10/2015
 
      import java.util.Scanner;
    public class spacebox
    {
    	public static void main( String[] args )
    	{
            Scanner keyboard = new Scanner(System.in);
            
            double v, m, j, s, u, n, weightA, weightB;
            v = .78;
            m = .39;
            j = 2.65;
            s = 1.17;
            u = 1.05;
            n = 1.23;
                
            System.out.print("Please enter your current earth weight: ");
            weightA = keyboard.nextDouble();
            System.out.println();
            System.out.println("I have information for the following planets:");
            System.out.println();
            System.out.println("    1.Venus     2.Mars      3.Jupiter");
            System.out.println("    4.Saturn    5.Uranus    6.Neptune");
            System.out.println();
            System.out.print("Which Planet are you visiting? ");
            weightB = keyboard.nextDouble();
            System.out.println();
            
            if (weightB == 1)
            {
            System.out.println("Your weight would be "+(weightA*v)+" pounds on that planet");    
            }
            else if (weightB == 2)
            {
            System.out.println("Your weight would be "+(weightA*m)+" pounds on that planet");            
            }
            else if (weightB == 3)
            {
            System.out.println("Your weight would be "+(weightA*j)+" pounds on that planet");            
            }
            else if (weightB == 4)
            {
            System.out.println("Your weight would be "+(weightA*s)+" pounds on that planet");            
            }        
            else if (weightB == 5)
            {
            System.out.println("Your weight would be "+(weightA*u)+" pounds on that planet");            
            }        
            else if (weightB == 6)
            {
            System.out.println("Your weight would be "+(weightA*n)+" pounds on that planet");            
            }     
            else
            {
            System.out.println("Please select one of the above planets");    
            }        
    
        }
    }
    

Picture of the output

Assignment 31