Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- System.out.print("Please enter your current weight in kilograms: ");
- double weight = input.nextDouble();
- System.out.println("\nI have information from the following planets");
- System.out.println("\t1. Venus \t2. Mars \t3. Jupiter");
- System.out.println("\t4. Saturn \t5. Uranus \t6. Neptune");
- System.out.print("\nWhich planet are you visiting: ");
- int planetChoice = input.nextInt();
- double planetWeight;
- if (planetChoice ==1){
- planetWeight = 0.78 * weight;
- }else if (planetChoice ==2){
- planetWeight = 0.39 * weight;
- }else if (planetChoice ==3){
- planetWeight = 2.65 * weight;
- }else if (planetChoice ==4){
- planetWeight = 1.17 * weight;
- }else if (planetChoice ==5){
- planetWeight = 1.05 * weight;
- }else if (planetChoice ==6){
- planetWeight = 1.23 * weight;
- }else{
- System.out.println("Please try again and input a correct number choice");
- }
- System.out.println("\nYour weight would be " + weight + " kgs on that planet.");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement