/* * CharGenerator.java * * Created on January 7, 2003, 2:54 PM * Modify this file, and turn in it. Do not change the package name, class name, * or any method signatures. */ package project0; /** Methods related to generating and testing characters, for the Diety of Luck * project. * Valid characters for this application are the 26 standard uppercase characters * used in English. * Note: there are standard Java library methods with signatures like * boolean isUpperCase(char) * Before using them, check carefully to see if their idea of "upper case" is * the same as the one used in this project. * * @author dickey */ public class CharGenerator { /** The 26 uppercase letters of English. * You can delete or ignore this if you wish. */ static String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; /** Creates a new instance of CharGenerator. Check that the internal table of upper case letters is plausible. */ public CharGenerator() { assert alphabet.length() == 26; //known length of the English alphabet for (int a = 0; a < alphabet.length(); a++) { char ch = alphabet.charAt(a); assert isEnglishUpperCase(ch); } //end constructor } /** Test if the character is a valid uppercase letter of English. * @param ch any (Unicode) character * @return true iff the character is valid, i.e., in the range A to Z. */ public static boolean isEnglishUpperCase(char c) { } /** Generate a random charachter, drawn from the internally known set of * upper case characters. * @return a character in the range A to Z. */ public static char randomUpperChar() { } //end CharGenerator }