Instructions:

  1. Define 1 argument constructure for title
  2. Define toString method for title, and a tester method.
  3. Generate a unique id for class
  4. Create a public getter that has book count
  5. Define tester method that initializes at least 2 books, outputs title, and provides a count of books in the library.

Part 2 --> extended classes

  1. Ensure novel and textbook run the Constructor from book
  2. Create instance variables unique to Novel has Authir, Textbook Company, These are not required in the constructor. Make sure there are getters and setters.
  3. Define a default method in Book that returns shelflife from date/time of a constructor. Define shelflife methods as needed in textbook and novel. A textbook has a fixed shelf life based on the datatypes of the constructor.
  4. Make a tmethod to count time book is checked out.
  5. Make a method to determine if book should come off the shelf
  6. define tester method to test items #1- #5.
public abstract class Books {
	public final String masterType = "Book";
	private String type;	// extender should define their data type

	// generic enumerated interface
	public interface KeyTypes {
		String title();
	}
	protected abstract KeyTypes getKey();  	// this method helps force usage of KeyTypes

	// getter
	public String getMasterType() {
		return masterType;
	}

	// getter
	public String getType() {
		return type;
	}

	// setter
	public void setType(String type) {
		this.type = type;
	}
	
	// this method is used to establish key order
	public abstract String toString();

	// static print method used by extended classes
	public static void print(Generics[] objs) {
		// print 'Object' properties
		System.out.println(objs.getClass() + " " + objs.length);

		// print 'Generics' properties
		if (objs.length > 0) {
			Generics obj = objs[0];	// Look at properties of 1st element
			System.out.println(
					obj.getMasterType() + ": " + 
					obj.getType() +
					" listed by " +
					obj.getKey());
		}



public class Novels extends Books {

	public static KeyTypes key = KeyType.title;  // static initializer
	public static void setOrder(KeyTypes key) { language.key = key; }
	public enum KeyType implements KeyTypes {title, name, age, language}

	// Instance data
	private final String name;
	private final int age;
	private final String language;

	/* constructor
	 *
	 */
	public language(String name, int age, String language)
	{
		super.setType("language");
		this.name = name;
		this.age = age;
		this.language = language;
	}

	/* 'Generics' requires getKey to help enforce KeyTypes usage */
	@Override
	protected KeyTypes getKey() { return language.key; }
Incomplete input:
|   public abstract class Books {
|   	public final String masterType = "Book";
|   	private String type;	// extender should define their data type
|   
|   	// generic enumerated interface
|   	public interface KeyTypes {
|   		String title();
|   	}
|   	protected abstract KeyTypes getKey();  	// this method helps force usage of KeyTypes
|   
|   	// getter
|   	public String getMasterType() {
|   		return masterType;
|   	}
|   
|   	// getter
|   	public String getType() {
|   		return type;
|   	}
|   
|   	// setter
|   	public void setType(String type) {
|   		this.type = type;
|   	}
|   	
|   	// this method is used to establish key order
|   	public abstract String toString();
|   
|   	// static print method used by extended classes
|   	public static void print(Generics[] objs) {
|   		// print 'Object' properties
|   		System.out.println(objs.getClass() + " " + objs.length);
|   
|   		// print 'Generics' properties
|   		if (objs.length > 0) {
|   			Generics obj = objs[0];	// Look at properties of 1st element
|   			System.out.println(
|   					obj.getMasterType() + ": " + 
|   					obj.getType() +
|   					" listed by " +
|   					obj.getKey());
|   		}
|   
|   		// print "Generics: Objects'
|   
|   
|   
|   
|   public class Books [] {
|   
|   
|       
|   
|   
|   }
|   
|   
|   
|   public class Novels extends Books {
|   	// Class data
|   	public static KeyTypes key = KeyType.title;  // static initializer
|   	public static void setOrder(KeyTypes key) { language.key = key; }
|   	public enum KeyType implements KeyTypes {title, name, age, language}
|   
|   	// Instance data
|   	private final String name;
|   	private final int age;
|   	private final String language;
|   
|   	/* constructor
|   	 *
|   	 */
|   	public language(String name, int age, String language)
|   	{
|   		super.setType("language");
|   		this.name = name;
|   		this.age = age;
|   		this.language = language;
|   	}
|   
|   	/* 'Generics' requires getKey to help enforce KeyTypes usage */
|   	@Override
|   	protected KeyTypes getKey() { return language.key; }
/* This is wrapper class...
 Objective would be to push more functionality into this Class to enforce consistent definition
 */
public abstract class Books {
	public final String masterType = "Book";
	private String type;	// extender should define their data type

	// generic enumerated interface
	public interface KeyTypes {
		String name();
	}
	protected abstract KeyTypes getKey();  	// this method helps force usage of KeyTypes

	// getter
	public String getMasterType() {
		return masterType;
	}

	// getter
	public String getType() {
		return type;
	}

	// setter
	public void setType(String type) {
		this.type = type;
	}
	

	public abstract String toString();

	public static void print(Books[] objs) {
		// print 'Object' properties
		System.out.println(objs.getClass() + " " + objs.length);

		// print 'Generics' properties
		if (objs.length > 0) {
			Books obj = objs[0];	// Look at properties of 1st element
			System.out.println(
					obj.getMasterType() + ": " + 
					obj.getType() +
					" listed by " +
					obj.getKey());
		}

		// print "Generics: Objects'
		for(Object o : objs)	// observe that type is Opaque
			System.out.println(o);

		System.out.println();
	}
}

public class Novel extends Books {
	// Class data
	public static KeyTypes key = KeyType.title;  // static initializer
	public static void setOrder(KeyTypes key) {Novel.key = key;}
	public enum KeyType implements KeyTypes {title, letter}
	private static final int size = 26;  // constant used in data initialization

	// Instance data
	private final char letter;
	
	/*
	 * single letter object
	 */
	public Novel(char letter)
	{
		this.setType("Novel");
		this.letter = letter;
	}

	/* 'Generics' requires getKey to help enforce KeyTypes usage */
	@Override
	protected KeyTypes getKey() { return Novel.key; }

	/* 'Generics' requires toString override
	 * toString provides data based off of Static Key setting
	 */
	@Override
	public String toString()
	{
		String output="";
		if (KeyType.letter.equals(this.getKey())) {
			output += this.letter;
		} else {
			output += super.getType() + ": " + this.letter;
		}
		return output;
	}

	// Test data initializer for upper case Alphabet
	public static Novel[] NovelData()
	{
		Novel[] Novel = new Novel[Novel.size];
		for (int i = 0; i < Novel.size; i++)
		{
			Novel[i] = new Novel( (char)('A' + i) );
		} 	
		return Novel;
	}
	
	/* 
	 * main to test Animal class
	 */
	public static void main(String[] args)
	{
		// Inheritance Hierarchy
		Novel[] objs = NovelData();

		// print with title
		Novel.setOrder(KeyType.title);
		Novel.print(objs);
	}
	
}
Novel.main(null);
|   		Novel[] Novel = new Novel[Novel.size];
cannot find symbol
  symbol:   variable size

|   		for (int i = 0; i < Novel.size; i++)
cannot find symbol
  symbol:   variable size

|   		Novel[] Novel = new Novel[Novel.size];
variable Novel might not have been initialized