From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.5 required=5.0 tests=BAYES_05,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,b3b3170c09dec29,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!z14g2000cwz.googlegroups.com!not-for-mail From: "ramesh" Newsgroups: comp.lang.ada Subject: Implementing linked attributes in ada Date: 22 Aug 2005 01:21:38 -0700 Organization: http://groups.google.com Message-ID: <1124698898.476920.72020@z14g2000cwz.googlegroups.com> NNTP-Posting-Host: 70.179.171.170 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1124698903 2362 127.0.0.1 (22 Aug 2005 08:21:43 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 22 Aug 2005 08:21:43 +0000 (UTC) User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: z14g2000cwz.googlegroups.com; posting-host=70.179.171.170; posting-account=jaODIw0AAAAqz8a5fLvIQzGSVAOK2M7x Xref: g2news1.google.com comp.lang.ada:4248 Date: 2005-08-22T01:21:38-07:00 List-Id: Hi Im trying to understand linked attributes in ada, can anybody can help me by sending relevant notes or links to study along with some sample programs?? my program has two records department and faculty, i have created a link attribute between them called Hire_data with attributes title and salary. In my program i need to have the folowing condition fulfilled, a department can hire atmost 10 faculty n a faculty can work no more than 2 departments. here is the specification i wrote actually this a part of my whole project with Ada.Text_IO; use Ada.Text_IO; with combined; use combined; with date_pack; use date_pack; package optionb is type Name1 is (None, JiahuangJi, KathrynWilliams, GeorgeBush, RoanldReagan, BillClinton, DavidBurris, PeterCooper, GarySmith, GracielaGonzalez, KenHeartness, LarryJones); type sex1 is (male, female); type Dept_Names is (None,COmputerScience, Biology); type Majors is (None,ComputerScience, Math, Business, Physics, Biology, Chemistry); Package Name_IO is new Ada.Text_IO.Enumeration_IO(Name1); use Name_IO; package Sex_IO is new Ada.Text_IO.Enumeration_IO(Sex1); use Sex_IO; package Majors_IO is new Ada.Text_IO.Enumeration_IO(Majors); use Majors_Io; package Dept_Names_IO is new Ada.Text_IO.Enumeration_IO(Dept_Names); use Dept_Names_IO; package Int_IO is new Integer_IO(Integer); use Int_IO; type Job_Title_Type is (None, Chair, Professor, AssistantProfessor, Lecturer); package Job_IO is new Ada.Text_IO.Enumeration_IO(Job_Title_Type); procedure put(Item: Job_Title_Type; Width: in Ada.Text_IO.Field := Job_IO.Default_Width; Set: in Ada.Text_IO.Type_Set:= Job_IO.Default_Setting) renames Job_IO.put; type Money is delta 0.01 range 0.00..100.00; package Money_IO is new Ada.Text_IO.Fixed_IO(Money); procedure put(Item: in Money; Default_Fore: Ada.Text_IO.Field := 4; Default_Aft: Ada.Text_IO.Field := 2; Default_Exp: Ada.Text_IO.Field :=0) renames Money_IO.put; type Hire_data_type; type Hire_Data_ptr is access Hire_Data_type; type Hire_Data_ptr_Array is array (1..2) of Hire_Data_ptr; type Faculty is new Employee with record name : Name1; Birthday : Date; sex: sex1; MajorField : Majors:=None; DeptEmbed : Department; --Dept_Emp_Array : DeptArray; NumDeptEmp : integer := 0; Dept_pt : Hire_Data_ptr_Array; end record; type Faculty_Ptr is access all Faculty'Class; type Hire_data_Type is record JOb_title : Job_Title_Type := none; Salary : Money := 0.00; Faculty_p : Faculty_ptr; Department_p : Dept_ptr; end record; procedure put(aFaculty: Faculty_Ptr); type Hire_Data_ptrArray is array(1..10) of Hire_data_ptr; type Department is new College with record Dept_Name : Dept_Names; FacultyEmp_Array : Fac_Array; NumFacEmp : Integer:= 0; staffEmp_Array : Staff_Array; NumStaffEmp : integer:=0; Faculty_pt : Hire_Data_ptrArray; end record; type Dept_Ptr is access all Department'Class; procedure put(aDepartment: Dept_ptr); procedure put_Faculty(aDepartment: Dept_Ptr); procedure Hire(aDepartment : in out Dept_ptr; aFaculty : in out Faculty_ptr; aHire : in out Hire_Data_ptr; aTitle : in Job_Title_Type;aSalary: Money); end optionb; I need hlp in writing the body to fulfill my condition. I also need to have another linked attribute "rating" for faculty record. waiting for ur help.....