• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Create a basic data management system for students

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In this exercise, you will create a basic data management system for students in the
Department of Industrial Engineering and Management.
You must write two classes – Student class from exercise 2, and StudentChart.
Student class consists of student data. StudentChart class contains data on all students.
(Up to 100 students may be studying at any one time).
For this purpose, you must fulfill the following interfaces (note - fields of the objects
should be marked as private).
Class: Student chart
Class of Student Chart contains data for all students. Department of studying students
at any one time are up to100 . Way to add a student, is by method addStudent only. At
the beginning of the course each student has not been added, the number of students
enrolled in the Department is 0. Think what would be the fields of this class, so that
you can know much information at any one time.
 
Bartender
Posts: 2911
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 ?



actually I've stock at the first , i did not understands what the program needs ? also I should submit it tomorrow
i need at first to know what is the data fields of the student Chart  class and if the student class extends the Student Chart class or not
thank you for you help      
 
salvin francis
Bartender
Posts: 2911
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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 ?
 
Marshal
Posts: 79962
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch again.

I am afraid that we take no notice of any urgency of requests.
Please start by re‑reading the instructions. What does it say about Student and StudentGraph?
What fields would you put into a Student object? What data would you think a Student would need?
 
rawd allan
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Campbell Ritchie
Marshal
Posts: 79962
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
. . . in which case, what does the Student class look like?
 
rawd allan
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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!


 
Campbell Ritchie
Marshal
Posts: 79962
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
rawd allan
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell 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.

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 programming  
 
Campbell Ritchie
Marshal
Posts: 79962
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, it is good object‑oriented code. But I can see a lots of potential improvements.
 
rawd allan
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Yes, it is good object‑oriented code. But I can see a lots of potential improvements.

the important thing for me now is how create the chart class using the data on the student class To achieve the previous output
 
rawd allan
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

rawd allan wrote:

Campbell Ritchie wrote:Yes, it is good object‑oriented code. But I can see a lots of potential improvements.

the important thing for me now is how create the chart class using the data on the student class To achieve the previous output


does the chart class extend the student class or vice versa ؟
 
Campbell Ritchie
Marshal
Posts: 79962
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

rawd allan wrote:. . . does the chart class extend the student class or vice versa ؟

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
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:

rawd allan wrote:. . . does the chart class extend the student class or vice versa ؟

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.


There are common fields between the two classes because the student outline contains information about the student such as his name, number and signs
 
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Class of Student Chart contains data for all students."

Now, does that sound like a Chart is-a Student (ie extends Student), or a Chart has Students (ie the Chart class has a colleciton of Students)?
 
rawd allan
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Marshal
Posts: 79962
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

rawd allan wrote:. . . There are common fields between the two classes because the student outline contains information about the student . . .

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 copy
 
rawd allan
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:

rawd allan wrote:. . . There are common fields between the two classes because the student outline contains information about the student . . .

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 copy

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 ?.
 
rawd allan
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

rawd 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

file:///C:/Users/user/Desktop/Dual102_Fall%202018_EX03.pdf
 
Campbell Ritchie
Marshal
Posts: 79962
396
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
rawd allan
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.


Thank you very much
Although the delivery date has been implemented but I must know how to fix it
 
Campbell Ritchie
Marshal
Posts: 79962
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's a pleasure

Now, how are you going to read words? Don't answer here.
 
Campbell Ritchie
Marshal
Posts: 79962
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.


public class studentChart {
ArrayList <studentChart> student = new ArrayList <studentChart> ();  
studentChart s=new studentChart();
 
}
 
Campbell Ritchie
Marshal
Posts: 79962
396
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That would imply that you are creating multiple charts, which I don't think is the aim of the exercise.
 
salvin francis
Bartender
Posts: 2911
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

rawd allan wrote:



Adding to what campbell pointed out, this looks like:
1. studentChart contains a list of studentChart
2. You're asking java to create an object of studentChart as soon as it loads the class studentChart

Your problem statement mentions something about students, departments and a chart. The code you shared is about Students and you have added grades to them. You have shared no information about what the chart should contain. I think you need first explain the problem more thoroughly. Your posted exercise does not cover the complete requirements.

Can you please share the exact requirements of what you want to achieve ?
 
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
reply
    Bookmark Topic Watch Topic
  • New Topic