Help with changing a Book Enum to a Book Class
I need some help changing an enum into a class.
Here is the enum code:
public enum Book
// declare constants of enum type
JHTP( "Java How to Program", "2012" ),
CHTP( "C How to Program", "2007" ),
IW3HTP( "Internet & World Wide Web How to Program", "2008" ),
CPPHTP( "C++ How to Program", "2012" ),
VBHTP( "Visual Basic 2010 How to Program", "2011" ),
CSHARPHTP( "Visual C# 2010 How to Program", "2011" );
// instance fields
private final String title; // book title
private final String copyrightYear; // copyright year
// enum constructor
Book( String bookTitle, String year )
title = bookTitle;
copyrightYear = year;
} // end enum Book constructor
// accessor for field title
public String getTitle()
} // end method getTitle
// accessor for field copyrightYear
public String getCopyrightYear()
} // end method getCopyrightYear
} // end enum Book
What is the class version of it, and why?
Thanks a ton!
Re: Help with changing a Book Enum to a Book Class
What have you tried? Where exactly are you stuck? What exactly has you confused? We can't just do your homework for you.