General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 26th, 2004, 11:48 AM
kemobye kemobye is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 3 kemobye User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
OOP nightmare!

I wants to store the details of employees in an electronic format (name, address, title, telephone number and date of birth). I system to allow for updating the details as well as adding or deleting employees.

I want to do the followings:

1. Identify the various elements of this system using an object-based design and clearly identify classes, attributes and associated methods from the above specification.

2. Produce an object-based design linked to the scenario described in the brief.


I decided to improve the system so that it includes the students, academic and administration staff of each department. The system should be able to show the qualifications, schedule and courses of each lecturer is working on. Also, it should be able to show the ID and the course each student has registered on.

A lecturer can lecture on different units of different courses.

Students can enrol on different part time courses but only one full time course.

I want to to this:

3. Modify my design to take into account the above improvements.

I wants to improve the system so that it is possible to store the details of students on a waiting list in a queue.

4. I would like to Produce an additional modification that will establish a queuing system that allocates places on a first come first served

//this is what I have, but it's far from finish it's
// I was wondering if someone help me out with this
//thanks


#include <iostream.h>
#include <string.h>
#include <stdlib.h>




class College
{

private:

char Director [17];
int Dir_ID;

public:

Collge(char *name,int ID);

void College:rint()
{
cout << "College" << endl;
cout << "Director: " <<Dir_ID << endl;
cout << "name" << Director << endl;
}





};



class Employeeublic College
{

protected:

char name[15];
char address [22];
char title[6];
int telephone;
int date_birth;

public:

Employee(){
strcpy (name,"");
date_birth = 0;
strcpy (address,"");
}




void setEmployee(char k[], char t[], char b[], int f, int db)
{
setname(k);
setaddress(b);
settitle(t);
settelephone(f);
setdate_birth(db);
}

void setname(char k[]){strcpy (name,k);}
void setaddress(char b[]){strcpy (address,b);}
void settitle(char t[]){strcpy (title,t);}
void settelephone(int f){telephone = f;}
void setdate_birth(int db){date_birth = db;}




char* getname(){return name;}
char* getaddress(){return address;}
char* gettitle(){return title;}
int gettelephone(){return telephone;}
int getdate_birth(){return date_birth;}




};

class Student : public College
{
protected:
int studentID;
char name[15];
public:
Student(){}
Student(char *nm, int id);

void Student::show()
{
cout << "Student" << endl;
cout << "ID: " << studentID << endl;
cout << "name" << name << endl;
}






};

class Academic : public College
{
protected:
int deptID;
char name;

public:
Academic(char *lect);

void Academic::show()
{
//cout << "Teacher" << endl;
cout << "Dept: " << deptID << endl;
cout << "name" << name << endl;
}


};


class Courseublic College
{
protected:
int id;
int register_on;
char *Lecture;
char *Qulification;
char *Schedule;


public:
course(int courseID, char *t, char *quil,char *Sch);


Course::Course(int courseID, char *t,char *quil, char *Sch)
{
id = courseID;
strcpy(Qulification, quil);
register_on = 0;
strcpy(Schedule, Sch);
strcpy(Lecture, t);

}

void Course::show()
{
cout << "Qulification" << Qulification<< endl;
cout << "Schedule: " << Schedule<<endl;
cout << "Course" << Lecture<<endl;
cout << "Student_ID" << id<<endl;


}


};

class Stack_queueublic College
{
private:
int Student[50];
int top;
//char name[16];
public:
Stack_queue();
void push(int);
//void push(char);
int pop();


} ;

Stack_queue::Stack_queue()
{ top = 0; }

void Stack_queue:ush(int Stu_id)
{
if (top == 50)
cout <<(" The Queue system is full");
else
{

Student[top] = Stu_id;
//Student[name]= name;
top++;


}
}


//void Stack_queue:ush(char name)
//{
// if (top == 50)
// cout <<(" The Queue system is full");
// else
// {

// //Student[top] = Stu_id;
// Student[name];
// top++;


int Stack_queue:op()
{
if ( top == 0)
{
cout <<("Student has been add to the system");
return 0;
}
else
{ top--;
return Student[top];
}
}



void main()
{



Stack_queue a;

int num;
//char name[16];
char reply;

do
{ cout << "Enter Student ID ";
cin >> num;
a.push(num);
//cout<<" Enter Student Name";
//cin>>name;
//b.push(name); a.push(name);
cout << " Do you want to add more Student to the queue, y for yes ";
cin >> reply;
}while ( reply =='y' || reply =='Y');

do
{ num = a.pop();
cout << num << '\n';
} while (num != 0);

}

Reply With Quote
  #2  
Old January 26th, 2004, 12:25 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
Where are you having the problem?
[I trust you don't expect someone else to write it for you]

Are you getting any errors?

In the future, when posting large amounts of code, its easier to post a file than to post the code directly... additionally, when posting small snippets of code, use the [ code][/code ] tags for formatting (without the spaces)

Reply With Quote
  #3  
Old January 26th, 2004, 12:44 PM
kemobye kemobye is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 3 kemobye User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
i'm stuck with "designing the Boxes before doing the actual coding" and plus saving the employee details. in the " void main()" i'm thinking about using Switch statement but I don't know how to go abou it!

Reply With Quote
  #4  
Old January 26th, 2004, 05:48 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
This is far from an OOP nightmare, but more of a great exercise to get you used to using objects...

Why not create a single class, like a person class... then create others which extend it (for students, academic and administration staff of each department)

The "parent" class, i'll call person, would contain any information which is common amongst all the different classifications of "employees"/people... such as name, address, title, telephone number and date of birth... each extended class, or child class, would then contain information specific to that type of person... a student may have grades, a teacher may have a pay scale...

Remember, for each attribute/variable inside an object, it helps to have methods which set and get them...

In your main then, you would have to declare each unique object and use the set methods to set their variables...

Simple pseudo code based on one person would look like this:
jeff = new Student()
jeff->setName("Jeff Jefferson")
jeff->setAddress("123 Fake St")


I hope this helps a bit...

I searched quickly, but couldn't find a C++ article... There's a lot of general OOP beginners articles out there if you Google for 'em...

In the meantime, try reading this Java one... Hope it helps:
http://builder.com.com/5100-6370-5032684.html

Reply With Quote
  #5  
Old January 27th, 2004, 10:25 AM
kemobye kemobye is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 3 kemobye User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thank you! I get the idea now.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > OOP nightmare!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT