MrDoyle

Space Boxing

Sep 18th, 2020
787
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.         Scanner input = new Scanner(System.in);
  7.         System.out.print("Please enter your current weight in kilograms: ");
  8.         double weight = input.nextDouble();
  9.  
  10.  
  11.         System.out.println("\nI have information from the following planets");
  12.         System.out.println("\t1. Venus \t2. Mars \t3. Jupiter");
  13.         System.out.println("\t4. Saturn \t5. Uranus \t6. Neptune");
  14.  
  15.         System.out.print("\nWhich planet are you visiting: ");
  16.         int planetChoice = input.nextInt();
  17.  
  18.         double planetWeight;
  19.         if (planetChoice ==1){
  20.             planetWeight = 0.78 * weight;
  21.         }else if (planetChoice ==2){
  22.             planetWeight = 0.39 * weight;
  23.         }else if (planetChoice ==3){
  24.             planetWeight = 2.65 * weight;
  25.         }else if (planetChoice ==4){
  26.             planetWeight = 1.17 * weight;
  27.         }else if (planetChoice ==5){
  28.             planetWeight = 1.05 * weight;
  29.         }else if (planetChoice ==6){
  30.             planetWeight = 1.23 * weight;
  31.         }else{
  32.             System.out.println("Please try again and input a correct number choice");
  33.         }
  34.  
  35.         System.out.println("\nYour weight would be " + weight + " kgs on that planet.");
  36.     }
  37. }
RAW Paste Data