comp.lang.ada
 help / color / mirror / Atom feed
From: "ramesh" <ramesh.mudedla@gmail.com>
Subject: Re: need help with errors im getting
Date: 2 Jul 2005 01:14:21 -0700
Date: 2005-07-02T01:14:21-07:00	[thread overview]
Message-ID: <1120292061.633464.143810@o13g2000cwo.googlegroups.com> (raw)
In-Reply-To: <l3eub1l2ru5pguun3kitesfmgnfngur7vp@4ax.com>

Hi

I need some help again, I finished with my recent types,
person,employee,student,citizen,faculty,staff.

now i have to add a university, college and department to be associated
to it.

The University has following fields:

name, Datefounded, collegeArray:array(1..4) of college_ptr; numcollege
:integer;
it has following methods
University(un,df)
printName()
InsertCollege(collpt)
printDateFOunded()
PrintAll() ------ should list all information abt university
including names of colleges.

I have got all methods in it excecpt in PrintAll() i m not able to
access colleges, i mean names of colleges associated with univ to
print.
i have got doubt abt Insert college also.


procedure InsertCollege(u: in out Univ_ptr; c: in out College_ptr; un:
Univ_Name1; df : Date; c1: College_Name) is--;c1: in out College_ptr)
is
begin
for i in 1..4 loop
u.Col_Array(i) := new College;
c.Name := un;
c.DateFounded := df;
c.Col_Name:= c1;
end loop
end InsertCollege;


------comment on above code if its correct and make necessary changes.
the doubt i have with it is when only one college details are passed to
it why i need a loop if i remove it the prob is when a second college
needs to be inserted in the array how to increment the value of i,
should i have explictly mention Col_array(1) Col_array(2) .... when a
new college is created.

The main prob is with my PrintAll()

in accesing the college names from college array
The code i wrote is
procedure PrintAll(u: Univ_ptr)is
temp: college_Array;
begin
new_line;
Put(" University Name : ");
put (u.Name);
new_line;
put(" The University was founded on : ");
put(u.DateFounded);
new_line;
put("******************************************");
new_line;
put("The colleges in the university are: ");
new_line;

put(u.Col_Array(1).Col_name);

--for i in 1..4 loop
--put(Col_Array(i).Col_Name);
--end loop;

--for i in 1..u.Col_Array'Last loop
--put(u.Col_Array(i.all));
--new_line;
--end loop;
end PrintAll;

it compiles but gives a constraint error when trying to print college
names

I can send the entire code if needed.




  parent reply	other threads:[~2005-07-02  8:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-24 21:59 need help with errors im getting ramesh
2005-06-24 22:42 ` Ed Falis
2005-06-25  1:43   ` ramesh
2005-06-25  6:17 ` Jeffrey Carter
2005-06-25 18:38   ` ramesh
     [not found]     ` <fovrb1t2l3nvsq6qden8vf2fkmgvg3614h@4ax.com>
     [not found]       ` <6g5sb1ptj1611oq6vbiirutlj9gv5lv39m@4ax.com>
2005-06-26  8:12         ` ramesh
2005-06-26  9:23           ` ramesh
     [not found]           ` <fu9ub1la6ofoc361j6pec48je2efh0b9e9@4ax.com>
     [not found]             ` <l3eub1l2ru5pguun3kitesfmgnfngur7vp@4ax.com>
2005-07-02  8:14               ` ramesh [this message]
2005-07-04  5:38               ` Dave Thompson
2005-07-04 21:16                 ` ramesh
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox