Results 1 to 3 of 3
  1. #1
    hlover is offline Member
    Join Date
    Nov 2008
    Posts
    1
    Rep Power
    0

    Exclamation plzzzz help me with this :(

    i have this project but i didnot know how to complete it
    Write a program to manage assigned course to students.
    The number of sections is unknown, and might change from a term to another.
    We assume that each student is recognized by his name and ID, and may receive a grade for a specific course.
    We also assume that each course has a name, an ID, and section name.
    Using a list of classes, and a list of students in the same class,

    - Register a new student to a new course
    - Add a new course,
    - Delete a course,
    - Remove a student from a course
    - Print all students in a course,
    - Print all courses associated to some student,
    - Assign a grade to a student
    and this is my sol :

    public class project {

    public class Node {

    private int id;
    private int Cnum;
    Node nexts;
    Node nextc;

    // --------------------------------

    public Node( int sno, int cno,Node n,Node n2)
    {

    id=sno;
    Cnum=cno;
    nexts=n;
    nextc=n2;
    }

    // ----------------------------------

    public Node()
    {
    id=0;
    Cnum=0;
    nexts= null;
    nextc=null;
    }
    }
    //################################################## ##########

    // student will add or drop courses

    public class section {
    //private Node head;
    //private Node tail;
    private String sectionName; //name of the section
    private String inst; // instructor name
    private int Snum; //section number
    SinglyLinkedList students; //object of class singly link list
    // ----------------------------------
    public section(String instructor ,String course,int snum)
    {
    inst=instructor;
    sectionName=course;
    Snum=snum;
    students =new SinglyLinkedList() ;
    }
    // ----------------------------------
    public void addToHead(int sid, int snum)
    {
    if (students.head ==null)
    {students.head=students.tail=new Node(sid,snum,null,null); }
    else
    students.tail.nexts=new Node(sid,snum,null,null);
    }
    // ----------------------------------
    public void deleteStudent( int sid, int snum)//delete using student section number
    {

    if (students.head==null) return;
    else
    { // if not empty list

    if ((students.head == students.tail) && (sid == students.head.id))
    { // if only one node in the list
    students.head = students.tail = null; // and el is the head
    }
    else if (sid == students.head.id) { // if more than one node in the list and el is head
    students.head = students.head.nexts;
    }
    else
    { // search for el starting at head, ending at tail
    Node pred;Node tmp;
    for (pred = students.head, tmp = students.head.nexts; (tmp != null) && !(tmp.id == sid);pred = pred.nexts, tmp= tmp.nexts);
    if (tmp != null)
    pred.nexts = tmp.nexts;
    if (tmp == students.tail)
    students.tail = pred;
    }
    }

    }
    //------------------------------------------------------





    // ################################################## ########

    //courses will be added or drop from student
    public class student {

    //private Node head;
    //private Node tail;

    private String lastName;
    private String firstName;
    private String grade;
    private int id;
    SinglyLinkedList sections;

    public student(String fn,String ln,int idnum)
    {
    lastName=ln;
    firstName=fn;
    id=idnum;
    grade=null;
    sections =new SinglyLinkedList() ;
    }
    //--------------------------------------

    public void addToHead(int sid, int snum) //add section to the student
    {
    if ((sections.head == null) && (sections.tail == null))
    sections.head = sections.tail = new Node(sid,snum,null,null);
    else
    head = new Node(ln,fn,no,head);
    sections.head = sections.tail = new Node(sid,snum,students.head,sections.head);

    }
    //--------------------------------------



    //################################################## ########

    public class SinglyLinkedList {

    public student[] s=new student[2000];
    public section[] sc=new section[200];
    public Node head;
    public Node tail;
    // ------------------------------------
    public SinglyLinkedList() //set head & tail to null
    {
    head = tail = null;
    }
    // ------------------------------------

    /*

    public boolean checkS()
    {

    }



    public linked()
    {
    for(int i=0;i<2000;i++)
    {
    s[i]=new student;

    }
    for(int j=0;j<2000;j++)
    {
    sc[i]=new section;
    }

    }
    public static void main(String[] args) {
    // TODO Auto-generated method stub

    }

    }




    plz help me how can i complet it :(

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    We're not so good at solving "fix it for me" type problems. First thing you need to do is to write out specifically what still needs to be solved here, then further break this list down into sub and sub-sub steps. Then try to solve each of these small steps. If you run into a specific problem with solving these smaller steps, then come on back with your attempt.

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Quote Originally Posted by hlover View Post
    plz help me how can i complet it :(
    You should specifically explain what the question is. At least start to work on step-by-step, as Fubarable says. No one here wants to do your homework.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •