EXAMPLE 11: More Methods
 

Write a program to read a set of charaters  until '0 'and print the one with the largest unicode.
 
class Example11{

     static void welcome(String name){
 
       System.out.println("****************************");
       System.out.println("Welcome to my program" + name);
    }

     static int largest(int a, int b){
        int large;
        if (a  >  b)
             large = a;
        else
             large = b;
        return(large);
     }
 
    static void printOutput(String name,  char toPrint){

      System.out.println("Here is your output" + name);
       System.out.println("The largest is " + toPrint);
    }

      public static void main(String[] args){

        String person;
        System.out.println("Enter your name");
        person = ReadUtility.readString();
 
         int x;
         x = welcome(person);

        welcome(person);

         char curr, currLarge;
         curr= ReadUtililty.readChar();
         currLarge = curr;
 
        while (curr != '0') {
 
         currLarge  =  largest(num, currLarge);
         currLarge =  (char) largest( (int) curr, (int) currLarge);
         curr= ReadUtility.readChar();
 
        }

        printOutput( currLarge);              

        } //end main
} //end class Example11