VGFacts

Full Version: Some programming help?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So, I need to create three classes in Java (Well BlueJ) and I understand how to create two of them, but not the other.

Basically, I need to create a field with a string variable to represent the title of a book, but I'm not sure how. The other two classes represent the length of the book in chapters and the remaining chapters left in the book.

My code is sort of like this.

public class Textbook
{
    private String "booktitle";
    private int chapters;
    private int chaptersleft;
}

I get that "Int" stands for integer and numbers should be placed in there (so int chapters can be 25, indicating 25 chapters) but I'm not sure how I'm meant to give my book a title. I'm not entirely sure if I should give it a title, or if I'm meant to create code that ALLOWS you to input a title for said book.

Any help would be appreciated. I don't really know where to post this on the internet, so I'd rather do it on a forum I know. I get confused on the basic stuff a lot of the time.

Also, any guides or websites/books that could help would also be great.
Its been a while since I've screwed with Java so my memory's a bit fuzzy in regards to it. I wasn't very good anyway.

http://www.homeandlearn.co.uk/java/user_input.html

Does this help?