Results 1 to 2 of 2
Like Tree1Likes
  • 1 Post By KevinWorkman

Thread: Help with changing a Book Enum to a Book Class

  1. #1
    Dragrain is offline Member
    Join Date
    Dec 2012
    Rep Power

    Question 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()
    return title;
    } // end method getTitle

    // accessor for field copyrightYear
    public String getCopyrightYear()
    return copyrightYear;
    } // end method getCopyrightYear
    } // end enum Book

    What is the class version of it, and why?

    Thanks a ton!

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Washington, DC
    Rep Power

    Default 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.
    Fubarable likes this.
    How to Ask Questions the Smart Way
    Static Void Games - GameDev tutorials, free Java and JavaScript hosting!
    Static Void Games forum - Come say hello!

Similar Threads

  1. CLASS BOOK HELP. Please.
    By ITshard in forum Forum Lobby
    Replies: 1
    Last Post: 08-27-2012, 07:56 AM
  2. Grade Book class, please help
    By star12345645 in forum New To Java
    Replies: 5
    Last Post: 12-11-2011, 02:46 AM
  3. public static enum vs enum class
    By Dipke in forum New To Java
    Replies: 3
    Last Post: 08-30-2011, 10:45 AM
  4. what book to buy ???
    By dhilipsiva in forum New To Java
    Replies: 8
    Last Post: 06-05-2011, 05:15 PM
  5. Is this book enough?
    By dushmantha.e in forum Java Certification
    Replies: 3
    Last Post: 04-06-2010, 03:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts