مشاهدة النسخة كاملة : برجكت


مبرررررررررررمجة
15-11-2007, 09:31 PM
أنا حالياً عندي بروجكت وحابه آخذ منكم بعض الخبرات لان هذا أول بروجكت لي؟


You are required to implement a student registration system. The system keeps information about the students including their id, which is an automatic number issued by the system, a name, and current number of courses. It is important to keep the count of courses a student is currently enrolled in since he is only allowed to register for 4 courses at any given point in time. The system should facilitate course registration and dropping through appropriate functions. The system should also keep record of the date in which the student enrolled.
Information about courses is also needed. For each course, the id and number of credits is stored. The id of the course is a single string composed of two parts: a two character code specifying the major (e.g. CS for Computer Science, MA for Mathematics, EC for economics.. etc) and a serial number, which, unlike the code, is generated by the system.

Task A
Create a header file for the class student which contains the following header, then write its implementation file.

#ifndef STUDENT_H_
#define STUDENT_H_

#include <iostream>
#include <string>
usingnamespace std;

class Student{
private:
staticint serialId;
constint id;
string name;
int currentCourses;
bool canRegisterMore();

public:
Student(string studentName);

bool registerCourse();

void dropCourse();

void printDetails();

};
#endif/*STUDENT_H_*/

Task B
Write a course class which contains number of credits and a string id. In addition to the constructor, it should contain a print function.

Task C
Modify the student class such that it contains an additional attribute (enrolment date) which is of type Date. Use the Date class that you have implemented in a previous lab session. Don’t forget to modify the constructor and any other functions accordingly.

أنا حاولت وحليت بس عندي مشكلة؟؟

#include <iostream>
using std::cout;
using std::cin;
#include <string>
using std::string;
using std::getline;
class Student{
private: static int serialId;
const int id;
string name;
int currentCourses;
public:

Student (string studentName):id(serialId)
{setname(studentName);
serialId++;}
void setname(string studentName)
{name=studentName;}
string getname()**
return name;
}
bool canRegisterMore()**
if(currentCourses<=4)
{return true;}
else
{return false;}
}
bool registerCours()**
cout<<"enter the current course:";
cin>>currentCourses;
if(canRegisterMore())
{currentCourses ++;
return true;}
else
** return false;}}

void dropCourse()**
if(currentCourses !=0)
** currentCourses--;

}
else
cout<<"sory";}


void printDetails() **
cout<< id<<name;


}
};
int Student::serialId=12324; ..هذا حل task A



#include <iostream>
using std::cout;
using std::cin;
#include <string>
using std::string;
using std::getline;
class Course{
private:
static int seralidd;
int x;
string id;
int credits;
public:
Course(string name, int c)
** x=seralidd;

id=name+itoe(x);
seralidd++;
credits=c;

}...هذا حل task B
وهنا المشكلة لاني استخدمت فنكشن تحول من int الى string
بس انا اشتغل على الفيجول وعرفت مكتبة لهذي الفكنشن اللي هي stido
بس مامشى الحال؟؟؟؟ارجو مساعدتي


class Date
{private:
int day,month,year;
public:
Date(int d,int m,int y)
** setday(d);
setmonth(m);
setyear(y);
}
void setmonth(int m)
{if(m>0 && m<=12)
month=m;
else
month=1;
}
void setday(int d)
{if(d>0 && d<=30)
day=d;
else
day=1;
}
void setyear(int y)
{year=y;
}
int getmonth()**
return month;}
int getday()**
return day;}
int getyear()**
return year;}
void print()**
cout<<day<<'/'<<month<<'/'<<year;}
};...هذا task c

*انا استخدم الفيجول والمطلوب في البروجكت اني افصل الهيدر عن الامبلميمنشيشن
ومشكلتي ان الفيجوال ما يمشي هذي الحركه أتمنى اللي يشتغل على الفيجوال وحاول بهذي الحركة ومشت معه يعلمني الطريقة...لان تسليمه راح يكون الاثنين وارجو المساااااااااعدة ولكم جزيل الشكر..