SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
lizz Palmer wrote:I know that it's the math part that isnt working. I added the "fail" to my string message just to see what it would display and it displays zeros for all of them. But i'm not sure what I have wrong!
lizz Palmer wrote:Isn't this setting the fail?:
public double getFail() {
return fail;
}
public void setFail(double fail) {
this.fail = fail;
Henry Wong wrote:You don't actually use the setter for the fail variable in your Student class -- so a student can only fail if the score is less than zero.
lizz Palmer wrote:Henry, this is my very very first java class and now my last because its so unbelievably had to comprehend. I don't know what you mean when you tell me I'm not using it. It's right there?!? it would be wonderful if you could give me a hint of some sort that I might understand. I have this project, one more and then my rediculous final. They told me I didn't need to know anything to take this course and obviously that's not true lol. The instructor doesn't answer my questions and it's an online class. I have just this forum to squeek by. It's destroying my perfect GPA hence why I am changing back to my MBA degree lol. Any hints you can give me would be very very appreciated. Lizz
Campbell Ritchie wrote:Should the fail field be part of the student class at all? If it should, surely it is the same for all students and ought to be static. Anyway, it ought to be initialised in a static initialiser (or in the constructor). And then the get and set methods should be static, too.
lizz Palmer wrote:Henry - Ok I think I get it a little better but when i put it in the while loop, it doesn't make a difference in the output.
while (aScanner.hasNext()){
Student student = new Student();
student.setLastName(aScanner.next());
student.setFirstName(aScanner.next());
student.setScore(aScanner.nextDouble());
student.setFail(fail);
total += student.getScore();
studentsArray[count] = student;
count++;
I'm assuming I would do it like that because I'm not calling it from the scanner document, it's just from the student class. ? Any suggestions what I am doing wrong?
lizz Palmer wrote:I know that it's the math part that isnt working. I added the "fail" to my string message just to see what it would display and it displays zeros for all of them. But i'm not sure what I have wrong!
lizz Palmer wrote:I tried moving the calculation for the fail class above the scanner but it just doesn't run that way.
lizz Palmer wrote:I really dont know what line I would be adding where lol. I looked at the values of fail and I think they say what I want so im lost.
lizz Palmer wrote:I've been trying what you said and doing it out on paper all day and I'm not further ahead.
Did you see how Paul cut 87% off of his electric heat bill with 82 watts of micro heaters? |