Advertisement
Guest User

Untitled

a guest
Feb 21st, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. // Mass and Weight
  2. // Kaleb Speas
  3. import java.util.Scanner;
  4. public class MassAndWeight
  5. {
  6. public static void main(String[] args)
  7. {
  8. Scanner keyboard = new Scanner(System.in);
  9. System.out.println("Please enter objects mass in grams.");
  10. double mass = keyboard.nextDouble();
  11. double weight = mass * 9.8;
  12. if (mass > 1000)
  13. System.out.println("Your object is too heavy!");
  14. else if (mass < 10)
  15. System.out.println("Your object is too light");
  16. else
  17. System.out.println("Your object weighs " + weight
  18. + " Newtons.");
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement