Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void InvestedYears()
- {
- // Variables
- char year;
- String Strings;
- int y = 0;
- Scanner keyboard = new Scanner(System.in);
- // Input
- System.out.print("Enter a year: ");
- Strings = keyboard.nextLine();
- year = Strings.charAt(y);
- for ( int i = 0; i < Strings.length() ; i++)
- {
- if(Character.isDigit(year)){
- System.out.println(Strings + " is numeric");
- year = Strings.charAt(y+1);
- }
- else {
- System.out.println(Strings + " is not numeric");
- year = Strings.charAt(y+1);
- }
- }
- System.out.println("The Year is " + Strings);
- }
Add Comment
Please, Sign In to add comment