0

help me with creating a program that will manage students and teachers.

my scenario is this: A Mom and Pop Grade school (grade 1 – 6) wants you to create a program that will manage their students and teachers. They have provided a menu for you to follow. 1. Add Student/Teacher 2. Remove Student/Teacher 3. Update Student/Teacher 4. Display all Students/Teachers Info 5. Display which teachers teach which grade 6. Display students in a certain grade 0. Exit This is my code so far: https://code.sololearn.com/cG0wRicSScc4 I don't know I'm doing it right or wrong. I'm stuck at when user put information how to go back to menu and I want to create super class for teacher and get do it... any ideas or help is awesome! thank you guys!

14th Jun 2017, 7:04 PM
Kurt Cobain
Kurt Cobain - avatar
2 odpowiedzi
+ 1
You could start by cleaning up the code you have. Refactor into multiple methods so your code is more readable. For instance, take the code that displays the menu and put it into a method called displayMenu() and call that from main instead of having all your code in main. Often breaking your code up into chunks like this will help your thought process. Menu, Student and Teacher could be there own classes. Student and Teacher might derive from (extend) another (abstract) class like Person or Human etc. You could also have a class that just handles displaying information. Your data handling should be separate from your other classes. If you need persistent data like a database or storing info in a file there should be a class that handles that. Options 1-6 look like they should be methods in the Student and Teacher Classes. You should loop until 0 is entered to exit. main should be something clean and simple like displayMenu(); int x = getInput(); handleInput(x);
14th Jun 2017, 9:09 PM
ChaoticDawg
ChaoticDawg - avatar
0
Thank you! so I have 5 classes 1. main 2.displaymenu 3. human 4. student 5.teacher but what should be in human class since option1-6 should be in the student and teacher classes? my main is displayMenu menu = new displayMenu(); menu.displaymenu(); now
15th Jun 2017, 12:09 AM
Kurt Cobain
Kurt Cobain - avatar