I forgot to post the code I have so far. I know this iis ugly but I have two excuses. First there are going to be several modules in the program so I trying to write one module at a time the past the whole thing together. The second reason is I don't know what I'm doing.
program displaycats1;
{$APPTYPE CONSOLE}
uses
SysUtils;
Const
space = ' ';
Type
CatTitle = string[15];
CatType = (Income,Expense);
BudgRec = Record
Category : CatType;
CatName : CatTitle;
Amount : real
end;
BudgArray = array[1..50] of BudgRec;
FileSource = File of BudgRec;
Var
BudgeRec : BudgRec;
Budge : BudgArray;
BudgFile : FileSource;
NumRecs,h : integer;
TotIncome,TotExpense : real;
begin
Assign (BudgFile,'budget.bin');
Reset (BudgFile);
NumRecs := 0;
While not EOF (BudgFile) do
begin
NumRecs := NumRecs + 1;
Read (BudgFile, Budge[NumRecs]);
End; {while}
Close (BudgFile);
writeln;
TotIncome := 0.0;
h := 0;
writeln ('Income:');
Repeat
h := h + 1;
BudgeRec := Budge[h];
If BudgeRec.Category = Income Then
Begin
writeln (Space:5,BudgeRec.Catname,space,BudgeRec.Amount:8:2);
TotIncome := TotIncome + BudgeRec.Amount;
End;
Until h = NumRecs;
writeln (Space:20,'-----------');
writeln (Space:5,'Total Income', space:5,TotIncome);
writeln;
readln
end.