By the way, you can make the code more readable by inserting it between "highlight=java" & "/highlight" , it will make it more colorful :) just use brackets instead of the (").
Type: Posts; User: ziplague
By the way, you can make the code more readable by inserting it between "highlight=java" & "/highlight" , it will make it more colorful :) just use brackets instead of the (").
This is the end of this thread, due to deadlines and exams coming soon, i have to submit my Java project for grading.
I want to thank everyone who helped me improve my code and solve problems :)...
I fixed the out of bounds exception.
By the way, about the error that i'm getting: it only occurs with certain indexes, usually with the ones at the end of the array (last index), if i add 3 books, index 2 and 1 work fine, which...
My bad, i uploaded the wrong version by mistake, here is the up to date version: 1121
About the right placement of the methods, you're right, i thought about that. I will move them to the book...
I updated my code and everything seems to be working fine with minor duplicates which i'm going to address tomorrow, but i keep getting this error:
Exception in thread "main"...
My lecturer told me that i can use someone else's code on three conditions:
1- i must understand the code, how it works etc...
2- it should constitute less than a third of my code, meaning that it...
@Tjstretch: Wow, cool, thank you for the fix :)
I just finished re-factoring the code into 6 different Classes, i can see the advantages now :) and i managed to use the Console class (it simplified lots of steps). I still have some minor bugs that...
I played around with the Console methods, all of them work great, as intended, apart from the readString() methods. If i press enter without writing anything, it prints the error prompt but then...
I have read the article and the code, some of it is a little hard to understand because i'm not used to using parameters in methods yet. How can i use the methods in class Console in class Book? ...
Alright, i'm reading the article right now, and i will address this issue today, thanks.
About the "if" choice statements, i'm familiarizing myself with the switch statement that was suggested, i never used it before. i can already see how it could reduce the code considerably, i just...
Thanks for pointing that out, i was planning on separating the parts at the end, it's just that i had lots of "static/non-static accessing methods and instances" problems at first so i just accepted...
"How are you dealing with invalid user input? The first thing your lecturer is going to do is to break your code by trying to put something invalid as a menu choice."
i know :) i broke it myself, i...
Hi everyone.
I have a java programming project, a simple library system:
User has to add books, borrow books, remove books, return books, clear library and exit the library.
This is University...
Anyway, thanks for your time and effort. I'm going to stick with my first version which worked the way i intended, since i'm not doing any GUI anytime soon (i know nothing about GUIs yet) and i have...
well, before that i put it in the PersonTest class and you told me to move it to "before the constructor", the constructor is in the Person class, so there it went.
When i do that i get an error :
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Syntax error on token(s), misplaced construct(s)
Syntax error on token ""\n>Type...
you say Get the values, how? i need to have i/o somewhere to get the values. Where should i put the i/o?
here's what i did:
import java.util.Scanner;
public class Person {
String name;
I'm sorry, i don't seem to understand what data you're talking about specifically. There is a lot of different data inside the class and inside the constructor. You're saying to put it outside the...
What do you mean by outside the person constructor, and what data do you mean?
What's the problem with having an Person object half built, what if a person doesn't have a personal number, in this...
Anyway, i will fix that. But my main concern is to try to improve the code, i feel as if i deviated from the assignment instructions. Especially concerning the instance variables and the creation of...
oops. Yes, cmd uses version 1.6, but why? i have both installed and the paths and classpaths are correct.
This is the error i get if i compile the PersonTest.java with both of the files seperate but in one folder (package javaLabs_4):...