Advertisement
Guest User

Untitled

a guest
Apr 25th, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class PlanetWeight {
  4.  
  5. public static void main(String[] args) {
  6. Scanner keyboard = new Scanner(System.in);
  7. int earthWeight, planet;
  8. double planetWeight = 0.0;
  9. System.out.print("Enter your weight on Earth");
  10. earthWeight = keyboard.nextInt();
  11. System.out.println();
  12. System.out.println("Here are the planets");
  13. System.out.println(" 1. Voltar 2. Krypton 3. Fertos");
  14. System.out.println(" 4. Servontos");
  15. System.out.println();
  16. System.out.print("Which planet are you visiting? ");
  17. planet = keyboard.nextInt();
  18. System.out.println();
  19. if (planet == 1) {
  20. planetWeight = earthWeight * 0.091;
  21. } else if (planet == 2) {
  22. planetWeight = earthWeight * 0.720;
  23. } else if (planet == 3) {
  24. planetWeight = earthWeight * 0.865;
  25. } else if (planet == 4) {
  26. planetWeight = earthWeight * 4.612;
  27. } else {
  28. System.out.println("Enter the planet you are visting.");
  29. }
  30. System.out.println("Your weight on this planet: " + planetWeight + " pounds");
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement