salvin francis wrote:Hi, First of all, welcome to coderanch !
I suggest that you first have a look at our forum rules:
DoYourOwnHomework <-- it’s a link
ShowSomeEffort <-- it’s a link
What have you done so far ? Where are you stuck at ?
rawd allan wrote:actually I've stock at the first
rawd allan wrote: i did not understands what the program needs ?
rawd allan wrote:student class extends the Student Chart class
salvin francis wrote:
rawd allan wrote:actually I've stock at the first
I think you probably mean "stuck"
rawd allan wrote: i did not understands what the program needs ?
Lets start by writing some code, your problem statement says that you need to write two classes : Student and StudentChart, can you share what you have done so far ?
Next, I feel that the question you posted is incomplete, it requires some more information present in "exercise 2" which you have not shared.
I presume that it could include Student details such as firstName, lastName, etc...
rawd allan wrote:student class extends the Student Chart class
Why do you think that Student should extend Student Chart ?
rawd allan wrote:
salvin francis wrote:
rawd allan wrote:actually I've stock at the first
I think you probably mean "stuck"
rawd allan wrote: i did not understands what the program needs ?
Lets start by writing some code, your problem statement says that you need to write two classes : Student and StudentChart, can you share what you have done so far ?
Next, I feel that the question you posted is incomplete, it requires some more information present in "exercise 2" which you have not shared.
I presume that it could include Student details such as firstName, lastName, etc...
rawd allan wrote:student class extends the Student Chart class
Why do you think that Student should extend Student Chart ?
I have finished the student class
rawd allan wrote:
rawd allan wrote:
salvin francis wrote:
rawd allan wrote:actually I've stock at the first
I think you probably mean "stuck"
rawd allan wrote: i did not understands what the program needs ?
Lets start by writing some code, your problem statement says that you need to write two classes : Student and StudentChart, can you share what you have done so far ?
Next, I feel that the question you posted is incomplete, it requires some more information present in "exercise 2" which you have not shared.
I presume that it could include Student details such as firstName, lastName, etc...
rawd allan wrote:student class extends the Student Chart class
Why do you think that Student should extend Student Chart ?
I have finished the student class
the output should be like : Prints the students data for all students as follow:
Student number 1:
<Student String representation>
Student number 2:
<Student String representation>
…
Student number <n>:
<Student String representation>
If there are no students print:
void printStudentChart() No students!
i am not sure that I've really understand your suggestion because my teacher discussed the code with me and she said it was very good and agreed to it because we are learning the object oriented programmingCampbell Ritchie wrote:Please always use the code button I have been back to your post and used the code button on your code, just this once, and doesn't it look better . I think the > in ine 24 (and 59) is there by our mistake.
I am pleased to see you know how to indent your code
What sort of comment is that supposed to be at the start of the class? Is it a block or documentation comment?
Why are you doing that relacing of upper‑case letters in the constructor? What does that do? If you are short of time, I think you have got more important things to think about; also why are you removing spaces? I haven't looked at the details of the replace() method for a long time, but I am 99% sure that it doesn't do what you want.
Why have you got a copy constructor? Do you need to copy a Student ever?
Why are you returning −1 in lines 49‑50? I think you will have to work out a different way to return something, because 0 is a valid result for a course. Notice the inconsistency with line 85.
You will get more marks if you are consistent about spacing: look at line 49.
Your setName() method duplicates code from the constructor. Find a way to avoid such duplication.
Do you want a method to set the Student's id? Will that value ever change?
Add {} to line 76. Explain why it is a very good idea to copy an array like that.
The equals() method must be overridden, which you are not doing. That method can accept two Students with different names as equal. Don't write if (b) return true; else return false; The od Sun Style Guide will tell you what to write instead.
the important thing for me now is how create the chart class using the data on the student class To achieve the previous outputCampbell Ritchie wrote:Yes, it is good object‑oriented code. But I can see a lots of potential improvements.
rawd allan wrote:
the important thing for me now is how create the chart class using the data on the student class To achieve the previous outputCampbell Ritchie wrote:Yes, it is good object‑oriented code. But I can see a lots of potential improvements.
Please re‑read the instructions. Please explain why a student would be a subtype of student graph. Also why a student graph would be a subtype of student.rawd allan wrote:. . . does the chart class extend the student class or vice versa ؟
Campbell Ritchie wrote:
Please re‑read the instructions. Please explain why a student would be a subtype of student graph. Also why a student graph would be a subtype of student.rawd allan wrote:. . . does the chart class extend the student class or vice versa ؟
Stephan van Hulst wrote:Not really, right? The chart contains data on ALL students, not just one.
Besides, just that two types have common fields does not mean one should be the subtype of the other. Does it make sense to say that a student is a graph, conceptually?
Why are you recording information twice? If you have two copies of the information and something changes, that gives you an opportunity to have one correct copy and one incorrect copyrawd allan wrote:. . . There are common fields between the two classes because the student outline contains information about the student . . .
i am not sure that i have really understand my question s what i should use in the chart class what is the data fields ?.Campbell Ritchie wrote:
Why are you recording information twice? If you have two copies of the information and something changes, that gives you an opportunity to have one correct copy and one incorrect copyrawd allan wrote:. . . There are common fields between the two classes because the student outline contains information about the student . . .
file:///C:/Users/user/Desktop/Dual102_Fall%202018_EX03.pdfrawd allan wrote:
Stephan van Hulst wrote:Not really, right? The chart contains data on ALL students, not just one.
Besides, just that two types have common fields does not mean one should be the subtype of the other. Does it make sense to say that a student is a graph, conceptually?
so should i start from the beginning and write a chart class ?
there is No time just 1 hour to submit
Campbell Ritchie wrote:I think the instruction about the chart holding data for students is unclear. I think the chart should contain a list of students and each student object holds its own data. As Stephan and I have tried to hint, the chart is not a subclass of student, and the students are not subclasses of the chart.
A chart HAS‑[A] Students; a Chart IS NOT A Student and a Student IS NOT A Chart.
Campbell Ritchie wrote:I only told you that because I knew the hand‑in time had passed; we wouldn't have told you that any earlier.
rawd allan wrote:
Campbell Ritchie wrote:I only told you that because I knew the hand‑in time had passed; we wouldn't have told you that any earlier.
rawd allan wrote:
30 seconds to difuse a loaf of bread ... here, use this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|