Guest User

Untitled

a guest
Jun 25th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. public static void InvestedYears()
  2. {
  3. // Variables
  4. char year;
  5. String Strings;
  6. int y = 0;
  7.  
  8. Scanner keyboard = new Scanner(System.in);
  9. // Input
  10. System.out.print("Enter a year: ");
  11.  
  12. Strings = keyboard.nextLine();
  13. year = Strings.charAt(y);
  14.  
  15. for ( int i = 0; i < Strings.length() ; i++)
  16. {
  17. if(Character.isDigit(year)){
  18. System.out.println(Strings + " is numeric");
  19.  
  20. year = Strings.charAt(y+1);
  21. }
  22. else {
  23. System.out.println(Strings + " is not numeric");
  24.  
  25. year = Strings.charAt(y+1);
  26. }
  27.  
  28. }
  29.  
  30.  
  31. System.out.println("The Year is " + Strings);
  32.  
  33. }
Add Comment
Please, Sign In to add comment