/home/caleb/ASDV-Java/Semester 3/Assignments/lab5-recursion2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/lab5/recursion2_calebfontenot/UpperCaseInArray.java
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package edu.slcc.asdv.caleb.lab5.recursion2_calebfontenot;

import java.util.Scanner;

/**
 *
 * @author caleb
 */
public class UpperCaseInArray {
    public static void main(String[] args)
    {
        System.out.print("Enter a string: ");
        Scanner input = new Scanner(System.in);
        String s = input.nextLine();
        char[] items = s.toCharArray();
        System.out.println("The number of uppercase letters is "
                    + count(items));
    }
    
    public static int count(char[] chars) {
        return count(chars, chars.length - 1);
    }
    public static int count(char[] chars, int high) {
        if (high >= 0) {
            return count(chars, high - 1) + (Character.isUpperCase(chars[high]) ? 1 : 0);
        } else {
            return 0;
        }
    }
}