Assignment #38 and SpaceBoxing
Code
/// Name: Josh Bautista
/// Period: 6
/// Program Name: SpaceBoxing
/// File Name: SpaceBoxing.java
/// Date Finished: 12/13/2015
import java.util.Scanner;
public class SpaceBoxing
{
public static void main( String[] args)
{
Scanner keyboard = new Scanner(System.in);
String name;
int age, earthWeight, planetVisiting;
double planetWeight;
System.out.print(" Please Input Name ");
name = keyboard.next();
System.out.println(" Welcome " + name + " to the Planet Weight Calculator ");
System.out.print(" Please Input Earth Weight ");
earthWeight = keyboard.nextInt();
System.out.println(" ..... Calculating ..... ");
System.out.println("");
System.out.println("");
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.print(" Which planet are you visiting? ");
planetVisiting = keyboard.nextInt();
if ( planetVisiting == 1)
{
System.out.println(" Your weight should be " + ( earthWeight * 0.78 ) + " on Venus ");
}
else if ( planetVisiting== 2)
{
System.out.println(" Your weight should be " + ( earthWeight * 0.39 ) + " on Mars ");
}
else if ( planetVisiting == 3)
{
System.out.println(" Your weight should be " + ( earthWeight *2.65 ) + " on Jupiter");
}
else if ( planetVisiting == 4)
{
System.out.println(" Your weight should be " + ( earthWeight * 1.17 ) + " on Saturn");
}
else if ( planetVisiting == 5)
{
System.out.println(" Your weight should be " + ( earthWeight * 1.05 ) + "on Uranus");
}
else if ( planetVisiting == 6)
{
System.out.println(" Your weight should be " + ( earthWeight * 1.23 ) + "On Neptune");
}
}
}
Picture of the output