SHARE
TWEET

Untitled

a guest Oct 18th, 2019 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner ;
  2.  
  3. public class weightCalc
  4. {
  5.    public static void main(String[] args)
  6.    {
  7.       Scanner inPut = new Scanner(System.in);
  8.    
  9.       double Mercury=0.055 , Venus=0.82 , Earth=1.0 , Mars=0.11 , Jupiter=318 , Saturn=95.2 , mass;
  10.       String planet ;
  11.      
  12.       System.out.print("Enter the planet name> ");
  13.          planet = inPut.nextLine();
  14.             planet = planet.toLowerCase();
  15.                planet = planet.substring(0, 1).toUpperCase() + planet.substring(1);
  16.          
  17.       if (planet != Mercury | Venus | Earth | Mars | Jupiter | Saturn)
  18.       {
  19.          System.out.println("name entered was invalid");
  20.          System.exit(0) ;
  21.          }
  22.        
  23.      
  24.       }
  25.      }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top