Map the COMPANY ER schema of Figure 7.2 into ODL classes. Include appropriate methods for each class.
What will be an ideal response?
```
class Employee
( extent employees
key ssn
{
attribute struct name {string fname, string mname, string lname}
name;
attribute string ssn;
attribute date bdate;
attribute enum Gender{M, F} sex;
attribute string address;
attribute float salary;
attributte Employee supervisor;
relationship Department works_for inverse Department::
has_employees;
relationship set
short age();
void give_raise(in float raise);
void change_address(in string new_address);
void reassign_emp(in string new_dname) raises(dname_not_valid);
};
class Department
( extent departments
key dname, dnumber
{
attribute string dname;
attribute short dnumber;
attribute struct Dept_Mgr {Employee manager, date startdate}
mgr;
attribute set
relationship set
relationship set
short no_of_employees();
void add_emp(in string new_essn) raises (essn_not_valid);
void add_proj(in string new_pname) raises (pname_not_valid);
void change_manger(in string new_mssn; in date startdate) raises
(mssn_not_valid);
};
class Project
( extent projects
key pname, pnumber
{
attribute string pname;
attribute short pnumber;
attributte string location;
relationship Department controlled_by inverse Department:: controls;
relationship set
void reassign_proj(in string new_dname) raises(dname_not_valid);
};
class Hours_Worked
( extent hours_worked
{
attributte float hours;
relationship Employee work_by inverse Employee:: work;
relationship Project work_on inverse Project:: work_at;
void change_hours(in float new_hours);
};
class Dependent
( extent dependents
{
attribute string name;
attribute date bdate;
attribute enum Gender{M, F} sex;
attribute string relationship;
attributte Employee suporter;
short age();
};
```
You might also like to view...
Which of the following tags is optional in table design?
A.