Help with School Assignment - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Help with School Assignment

iVaroiVaro Posts: 2Member
Hey I'm supposed to write a program that will accept up to 21 person's names and their category in a club. Using that I'm supposed to calculate how much is due to the club as well as how much is [italic]owed[/italic].
There are four categories and I'm basically finished but I hit a snag
This is the code. I know it's pretty long but I really need the help because it's due tomorrow. The problem is that after the input name and amount section absolutely no calculations seem to be done. I'm supposed to calculate many things and I dont know what to do :C

* sba*)

program SBA;

var

mem_name: array [1..21] of string;
fee: array [1..21] of integer;

stu_amt, stu_out_amt, stu_fine :real;
reg_amt,reg_out_amt, reg_fine :real;
gold_amt,gold_out_amt, gold_fine :real;
plat_amt,plat_out_amt, plat_fine :real;
tot_amt,tot_out_amt,maxfine :real;
I,O,n :integer;
memcat :string;

Begin

stu_amt := 0;
stu_out_amt := 0;
stu_fine := 0;
reg_amt :=0 ;
reg_out_amt := 0 ;
reg_fine := 0 ;
gold_amt := 0 ;
gold_out_amt := 0 ;
gold_fine := 0 ;
plat_amt := 0 ;
plat_out_amt := 0;
plat_fine := 0 ;
tot_amt := 0;
tot_out_amt := 0;
O := 0;n :=0;
maxfine := 0;

Writeln ('How many members will you enter?');
Readln (n);
If n > 21 then
repeat until n <= 21;

For I := 1 to n do begin
writeln ('Enter the name of the member');
Readln (mem_name[I]);
Writeln ('Enter the category of the member');
Readln (memcat);
If (memcat = 'student')then begin
Writeln (' Enter the amount paid');
Readln (fee[I]);
stu_amt := 12*100*4;
stu_out_amt := (stu_amt-fee[I]);
end

else If(memcat = 'regular') then begin
Writeln (' Enter the amount paid');
Readln (fee[I]);
reg_amt := 12*150*4;
reg_out_amt := (reg_amt-fee[I]);
end

else If (memcat = 'gold') then begin
Writeln (' Enter the amount paid');
Readln (fee[I]);
gold_amt := 12*200*4;
gold_out_amt := (gold_amt-fee[I]);
end

else If (memcat = 'platinum') then begin
Writeln (' Enter the amount paid');
Readln (fee[I]);
plat_amt := 12*250*4;
plat_out_amt := (plat_amt-fee[I]);
End;

If stu_out_amt > 0 then
O := O+1;
End;
stu_fine := 0.20 * stu_out_amt;

If (stu_fine > maxfine) then
maxfine:= stu_fine;
End.

tot_amt := tot_amt + stu_amt;
tot_out_amt := stu_out_amt + tot_out_amt;


If reg_out_amt > 0 then
O := O+1;
End;
reg_fine := 0.20 * reg_out_amt;

If (reg_fine > maxfine) then
maxfine:= reg_fine;
End;

tot_amt := tot_amt + reg_amt;
tot_out_amt := reg_out_amt + tot_out_amt;

If gold_out_amt > 0 then
O := O+1;
End;
gold_fine := 0.20 * gold_out_amt;

If (gold_fine > maxfine) then
maxfine:= gold_fine;
End;

tot_amt := tot_amt + gold_amt;
tot_out_amt := gold_out_amt + tot_out_amt;

If plat_out_amt > 0 then
O := O+1;
End;
plat_fine := 0.20 * plat_out_amt;

If (plat_fine > maxfine) then
maxfine:= plat_fine;
End;

tot_amt := tot_amt + plat_amt;
tot_out_amt := plat_out_amt + tot_out_amt;
End;
Writeln ('The total amount due is', tot_amt);
Writeln ('The total oustanding amount is', tot_out_amt);
Writeln ('The highest fine is', maxfine);
Writeln ('The number of persons with annoying fees are', O);
End.




Sign In or Register to comment.