comp.lang.ada
 help / color / mirror / Atom feed
* explain error to me
@ 2001-07-05 22:18 Beau
  2001-07-05 22:41 ` Don't read any more, I am an idiot. Fixed it myself Beau
  2001-07-05 22:48 ` explain error to me chris.danx
  0 siblings, 2 replies; 5+ messages in thread
From: Beau @ 2001-07-05 22:18 UTC (permalink / raw)


I am getting an error can someone help:
the spec file as follows:
----------------------------------------------------------------
--This is the Spec file for the package Print_Table.
--created by Beau Elliott
---------------------------------------------------------------------

PACKAGE Print_Table IS

--------------------------------------------------------------------------
--declarations needed in the package

SUBTYPE IDnumbers IS Natural RANGE 0..9999; --subtype for ID numbers

TYPE HouseHolds IS RECORD  --record for each house containing its ID
 ID : IDnumbers;         --number, Annual Income, and the number of
 Income : Natural;       --People living there
 Members : Positive;
END RECORD;

SUBTYPE ArrayCounter IS Natural RANGE 1..25; --counter for the number of
       --houses we are using
ArraySize : CONSTANT Positive := 25;

TYPE HouseArrays IS ARRAY (ArraySize) OF HouseHolds;

ListofHouses : HouseArrays;

Poverty : Natural;  --variable to tell if the house lives under or above
                    --poverty

Pause : Character;  --pause between reading of tables

------------------------------------------------------------------------
--procedures needed are:

Procedure PrintList(ListofHouses : HouseHolds);
--pre: ListofHouses array is passed already defined
--post: The ListofHouses is printed on the screen

Procedure AboveAverageIncome(ListofHouses : HouseHolds);
--pre: ListofHouses array is passed already defined
--post: The list of Houses that is above the poverty line is printed
--------along with the ID and Income of the house

Procedure BelowAverageIncome(ListofHouses : HouseHolds);
--pre: ListofHouses array is passed already defined
--post: The list of houses that is below poverty rate is printed
--------with the House's ID

END Print_Table;

----------------------------------------------------------------------------
------------------------------------------------------------------
the body of the package is as follows:
-----------------------------------------------------
WITH Ada.Text_IO;
USE Ada.Text_IO;
WITH Ada.Integer_Text_IO;
USE Ada.Integer_Text_IO;


PACKAGE BODY Print_Table IS

 PROCEDURE PrintList(ListofHouses : HouseArrays) IS

 BEGIN
  Put(Item => "Household Income Table. This will tell 25 ");
  New_Line;
  Put(Item => "Houses ID number, Annual Income, and how many ");
  Put(Item => "people live there.");
  New_Line(Spacing => 3);
  Put(Item => "Identification Number    Annual Income");
  Put(Item => "      Household Numbers");
  New_Line;
  Put(Item => "__________________________________________________");
  New_Line;

  FOR Counter IN ArrayCounter LOOP
   Put(Item => ListofHouses(Counter).ID, width => 6);
   Put(Item => ListofHouses(Counter).Income, Width => 6);
   Put(Item => ListofHouses(Counter).Members, Width => 6);
   New_Line;
  END LOOP;

 END PrintList;


 PROCEDURE AboveAverageIncome(ListofHouses : HouseHolds) IS

  BEGIN
   Put(Item => "This Table will represent each house that is ");
   New_Line;
   Put(Item => "above the poverty line.");
   New_Line(Spacing => 3);
   Put(Item => "Identification Number      Annual Income");
   New_Line;
   Put(Item => "_______________________________________________");
   New_Line;

   FOR Counter IN ArrayCounter LOOP
    Poverty := 0;
    Poverty := 6500 + (750 * (ListofHouses(Counter).Member - 2));

    IF ListofHouses(Counter).Income >= Poverty THEN
     Put(Item => ListofHouses(Counter).ID, Width => 6);
     Put(Item => ListofHouses(Counter).Income, Width => 6);

    END IF;
    New_Line;
   END LOOP;
  END AboveAverageIncome;

 PROCEDURE BelowAverageIncome(ListofHouses : HouseHolds) IS

  BEGIN
   Put(Item => "This table will represent each house that is below");
   New_Line;
   Put(Item => "the poverty line.");
   New_Line(Spacing => 3);
   Put(Item => "Identification Number");
   Put(ITem => "________________________");
   FOR Counter IN ArrayCounter LOOP
    Poverty := 0;
    Poverty := 6500 + (750 * (ListofHouses(Counter).Member - 2));
    IF ListofHouses(Counter).Income < Poverty THEN
     Put(Item => ListofHouses(Counter).ID, Width => 6);
    END IF;
    New_Line;
   END LOOP;

  END BelowAverageIncome;

END Print_Table;
--
~Beau~
beau@hiwaay.net






^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-07-06  2:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-05 22:18 explain error to me Beau
2001-07-05 22:41 ` Don't read any more, I am an idiot. Fixed it myself Beau
2001-07-05 22:53   ` chris.danx
2001-07-05 22:48 ` explain error to me chris.danx
2001-07-06  2:01   ` Jeffrey Carter

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