Advertisement
Guest User

Untitled

a guest
May 25th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. // Prompting the user for Score (Numerical Grade)
  2. System.out.println("Kindly input Numerical Score: (Enter s to Skip)");
  3.  
  4. // reading the input into the line variable of string datatype
  5. String line = input.nextLine();
  6.  
  7. // checking if line =="s" or =="S" to skip, otherwise
  8. // the value is parsed into a double
  9.  
  10. if("s".equals(line) || "S".equals(line))
  11. {
  12. }else try
  13. {
  14. score = Double.parseDouble(line);
  15. System.out.println(score);
  16. } catch( NumberFormatException nfe)
  17. {
  18.  
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement