That is a good start, which suggest you are going to get it rightStephen Nickalls wrote:. . .
student.mathMarks = mathMarks;
student.englishMarks = englishMarks;
Campbell Ritchie wrote:I didn't notice you have been given an assignment showing public fields; I would regard public fields as a poor design feature in any code.
Creates a new Student object and two AsignmentMarks objects (for Mathematics and
English). Assign the values of these three objects using the parameters given. Remember
to assign the two AssignmentMarks objects to the Student object. Finally, adds the
Student to the list of students.
Junilu Lacar wrote:That assignment is horrific. The method is poorly designed and it is not even the right way you'd do that in an object-oriented manner. I hope you didn't have to pay to take that course because frankly, you shouldn't have to pay to learn how to write bad code.
In which case a revolution is called for Junilu is right; that course appears to be a waste of money.Andrew Chipperfield wrote:. . . This is a government certified qualification . . . .
Liutauras Vilda wrote:@OP
1. I don't understand why you call method addStudent(), but doing something with AssignmentMarks within its body. If I try to imagine how the method addStudent() may look like, I get something like:
2. Why method removeStudent() is configured to remove student's mark and not what the method suggests?
3. Please explain what this line returns as a value?
What value this got?
4. Student students... Why do you call it students? Student object supposed to represent a singular student, while an array or list of students could hold more students.
Raising those questions so you could potentially question your approach.
Creates a new Student object and two AsignmentMarks objects (for Mathematics and English). Assign the values of these three objects using the parameters given. Remember to assign the two AssignmentMarks objects to the Student object. Finally, adds the Student to the list of students.
private static void removeStudent()
Asks the user to enter an ID. Then removes the student with that ID.
Note: This will only remove a student in the LinkedList, it will not affect the “studentdata.txt” file.
Andrew Chipperfield wrote:...the assignment i was given has preset methods, which I have to fill the body of the method with, the addStudent method...
...Finally, adds the Student to the list of students.
Andrew Chipperfield wrote:the removeStudent method is meant to take the students ID as input and remove the student with all their marks from the LinkedList
Junilu Lacar wrote:If this is how you're adding to the list:
then you have to use the same value to remove it. You say you just wanted to get it done and move on but that is quite horrific, if you ask me.
All things are lawful, but not all things are profitable.
Knute Snortum wrote:Think about the else clause of your if statement and what it does. Try stepping through the process mentally or on paper.
I'm not dead! I feel happy! I'd like to go for a walk! I'll even read a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|