Assignemnt #38 Space Boxing
Code
/// Name: Jake Johnson
/// Period: 7
/// Program Name: Space Boxing
/// File Name: SpaceBoxing.java
/// Date Finished: 10/5/2015
import java.util.Scanner;
public class SpaceBoxing
{
public static void main (String[] args)
{
Scanner keyboard = new Scanner(System.in);
double PlanetVisi ting, Weight, VenusWeight, MarsWeight, JupiterWeight, SaturnWeight, UranusWeight, NeptuneWeight;
System.out.print("Please enter your current Earth weight: ");
Weight = keyboard.nextDouble();
System.out.println();
VenusWeight = Weight * 0.78;
MarsWeight = Weight * 0.39;
JupiterWeight = Weight * 2.65;
SaturnWeight = Weight * 1.17;
UranusWeight = Weight * 1.05;
NeptuneWeight = Weight * 1.23;
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();
System.out.print("Which planet are you visiting? ");
PlanetVisiting = keyboard.nextDouble();
System.out.println();
if (PlanetVisiting == 1) //Venus
{
System.out.println("Your weight would be " + VenusWeight + " pounds on that planet");
}
else if (PlanetVisiting == 2) //Mars
{
System.out.println("Your weight would be " + MarsWeight + " pounds on that planet");
}
else if (PlanetVisiting == 3) //Jupiter
{
System.out.println("Your weight would be " + JupiterWeight + " pounds on that planet");
}
else if (PlanetVisiting == 4) //Saturn
{
System.out.println("Your weight would be " + SaturnWeight + " pounds on that planet");
}
else if (PlanetVisiting == 5) //Uranus
{
System.out.println("Your weight would be " + UranusWeight + " pounds on that planet");
}
else if (PlanetVisiting == 6) //Neptune
{
System.out.println("Your weight would be " + NeptuneWeight + " pounds on that planet");
}
}
}
Picture of the output