Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner ;
- public class weightCalc
- {
- public static void main(String[] args)
- {
- Scanner inPut = new Scanner(System.in);
- double Mercury=0.055 , Venus=0.82 , Earth=1.0 , Mars=0.11 , Jupiter=318 , Saturn=95.2 , mass;
- String planet ;
- System.out.print("Enter the planet name> ");
- planet = inPut.nextLine();
- planet = planet.toLowerCase();
- planet = planet.substring(0, 1).toUpperCase() + planet.substring(1);
- if (planet != Mercury | Venus | Earth | Mars | Jupiter | Saturn)
- {
- System.out.println("name entered was invalid");
- System.exit(0) ;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement