VGFacts
Some programming help? - Printable Version

+- VGFacts (https://archive.vgfacts.com)
+-- Forum: Other Discussions (https://archive.vgfacts.com/forum-6.html)
+--- Forum: Help! (https://archive.vgfacts.com/forum-13.html)
+--- Thread: Some programming help? (/thread-2815.html)



Some programming help? - retrolinkx - 11-02-2015

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.


RE: Some programming help? - Psychospacecow - 11-02-2015

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?