Assignment #38 Space Boxing
Code
///Name: Ian Grant
///Period:5
///Project Name: Space Boxing
///File Name:spaceboxing.java
///10/21/15
import java.util.Scanner;
public class spaceboxing
{
public static void main(String[] args)
{
Scanner stuff=new Scanner(System.in);
int w,p;
System.out.print("Please enter you weight: ");
w=stuff.nextInt();
System.out.println("I have information for the following planets:");
System.out.println("\t 1. Venus\t 2. Mars\t 3. Jupiter");
System.out.println("\t 4. Saturn\t 5. Uranus\t 6. Neptune");
System.out.print("What planet do you want to vist? ");
p=stuff.nextInt();
if (p==1)
{
System.out.print("Your weight would be "+(w*0.78)+" pounds on that planet.");
}
else if (p==2)
{
System.out.print("Your weight would be "+(w*0.39)+" pounds on that planet.");
}
else if (p==3)
{
System.out.print("Your weight would be "+(w*2.65)+" pounds on that planet.");
}
else if (p==4)
{
System.out.print("Your weight would be "+(w*1.17)+" pounds on that planet.");
}
else if (p==5)
{
System.out.print("Your weight would be "+(w*1.05)+" pounds on that planet.");
}
else if (p==6)
{
System.out.print("Your weight would be "+(w*1.23)+" pounds on that planet.");
}
}
}
Output