Recent

Author Topic: 135 / 22 hclroh~1.pas Fatal: Syntax error, ; expected but identifier WRITELN  (Read 6083 times)

ALI ROOPNARINE

  • Guest
the error below was found


135 / 22 hclroh~1.pas
 Fatal: Syntax error, ; expected but identifier WRITELN found

Program HCL (input,output);
CONST
Max=45;
Positive='Qualified';
Negative='Not Qualified';
QualifyClark=10000;
QualifyBGarden=7500;
QualifySkyfall=5500;
BTime=3;
ZERO=0;
BRate=10/100;
CCTime=3/2;
CCRate=15/100;
CUTime=3;
DependentAllowance=75;
Half=1/2;
CORRECT='Approved';
WRONG='Not Approved';
TYPE
StringArray=ARRAY[1..Max] OF String;
RealArray=ARRAY[1..Max] OF Real;
IntegerArray=ARRAY[1..Max] OF Integer;
VAR
ApplicantName:StringArray;
HousingCommunity:StringArray;
ApplicantGrossSalary:RealArray;
ApplicantSalaryDeductions:RealArray;
ApplicantSpouse:StringArray;
SpouseGrossSalary:RealArray;
SpouseSalaryDeductions:RealArray;
ApplicationStatus:StringArray;
FinalApplicationStatus:StringArray;
NetSalaries:RealArray;
ApplicantExpenses:RealArray;
ApplicantRepayments:RealArray;
Applicant:Integer;
Name:String;
Housing:String;
GSalary:Real;
Deductions:Real;
Spouse:String;
SpouseSalary:Real;
SpouseDeductions:Real;
TotalGrossSalary:Real;
TotalSalaryDeductions:Real;
NetSalary:Real;
HalfNetSalary:Real;
Balance:Real;
Groceries:Real;
Water:Real;
Telephone:Real;
Electricity:Real;
Transport:Real;
Dependents:Integer;
Miscellaneous:Real;
CCBalance:Real;
CCInterest:Real;
TotalCCAmount:Real;
CCMonthlyPayments:Real;
BPrinciple:Real;
BLoanInterest:Real;
TotalBLoanAmount:Real;
BMonthlyPayments:Real;
CUPrinciple:Real;
CUInterest:Real;
TotalCULoanAmt:Real;
CUMonthlyPayments:Real;
TotalMonthlyRepayments:Real;
Sum:Integer;
BEGIN{MAIN}
      FOR Applicant:=1 TO Max DO
      BEGIN{FOR}
           ApplicantName[Applicant]:='';
           HousingCommunity[Applicant]:='';
           ApplicantGrossSalary[Applicant]:=0;
           ApplicantSalaryDeductions[Applicant]:=0;
           ApplicantSpouse[Applicant]:='';
           SpouseGrossSalary[Applicant]:=0;
           SpouseSalaryDeductions[Applicant]:=0;
           ApplicationStatus[Applicant]:='';
           FinalApplicationStatus[Applicant]:='';
           NetSalaries[Applicant]:=0;
           ApplicantExpenses[Applicant]:=0;
           ApplicantRepayments[Applicant]:=0;
      FOR Applicant:=1 TO Max DO
      BEGIN{FOR}
           Write('What is the name of the applicant?');
           Readln(Name);
           ApplicantName[Applicant]:=Name;
           Write('For which of the following housing communities are applications being made: "ClarkVillas", "BrentwoodGardens" or "SkyfallCourts"?');
           Readln(Housing);
           HousingCommunity[Applicant]:=Housing;
           Write('What is the applicants gross salary?');
           Readln(GSalary);
           ApplicantGrossSalary[Applicant]:=GSalary;
           Write('What are the applicants salary deductions?');
           Readln(Deductions);
           ApplicantSalaryDeductions[Applicant]:=Deductions;
           Write('Does the applicant have a spouse?');
           Readln(Spouse);
           ApplicantSpouse[Applicant]:=Spouse;
           IF Spouse='Yes' THEN
           BEGIN{IF}
                Write('What is the spouses gross salary?');
                Readln(SpouseSalary);
                SpouseGrossSalary[Applicant]:=SpouseSalary;
                Write('What are the spouses salary deductions?');
                Readln(SpouseDeductions);
                SpouseSalaryDeductions[Applicant]:=SpouseDeductions;
           BEGIN{ELSE}
                SpouseSalary:=ZERO;
                SpouseGrossSalary[Applicant]:=SpouseSalary;
                SpouseDeductions:=ZERO;
                SpouseSalaryDeductions[Applicant]:=SpouseDeductions;
      FOR Applicant:=1 TO Max DO
      BEGIN{FOR}
           TotalGrossSalary:=ApplicantGrossSalary[Applicant]+SpouseGrossSalary[Applicant];
           TotalSalaryDeductions:=ApplicantSalaryDeductions[Applicant]+SpouseSalaryDeductions[Applicant];
           NetSalary:= TotalGrossSalary-TotalSalaryDeductions;
           NetSalaries[Applicant]:=NetSalary;
      FOR Applicant:=1 TO Max DO
      BEGIN{FOR}
           IF HousingCommunity[Applicant]='ClarkVillas' THEN
           BEGIN{IF}
                IF NetSalaries[Applicant]>QualifyClark THEN
                BEGIN{IF}
                     Writeln('Qualified');
                     ApplicationStatus[Applicant]:=Positive;
                     Writeln('Not Qualified');
                     ApplicationStatus[Applicant]:=Negative;
                IF HousingCommunity ='BrentWoodGardens' THEN
                IF NetSalaries[Applicant]>QualifyBGarden THEN
                     Writeln('Qualified');
                     ApplicationStatus[Applicant]:=Positive; THEN
                     Writeln('Not Qualified');
                     ApplicationStatus[Applicant]:=Negative;
           IF HousingCommunity[Applicant]:='SkyfallCourts' THEN
                IF NetSalaries[Applicant]>QualifySkyfall THEN
                     Writeln('Qualified');
                     ApplicationStatus[Applicant]:=Positive; THEN
                     Writeln('Not Qualified');
                     ApplicationStatus[Applicant]:=Negative;
      FOR Applicant:=1 TO Max DO
           IF ApplicationStatus[Applicant]:=Postive THEN
                Write('What is the principle loan Amount borrowed from the bank?');
                Readln(BPrinciple);
                Write('What is the outstanding balance on the credit card?');
                Readln(CCBalance);
                Write('What is the principle loan Amount borrowed from the credit union?');
                Readln(CUPriniple);
                BLoanInterest:=(BPrinciple*BTime*BRate)/100;
                TotalBLoanAmt:=BLoanInterest+BPrinciple;
                BMonthlyPayments:=TotalBLoanAmt/36;
                CCInterest:=(CCBalance*CCTime*CCRate)/100;
                TotalCCAmt:=CCInterest+CCBalance;
                CCMonthlyPayents:=TotalCCAmt/18;
                CUInterest:=(CUPrinciple*CUTime*CURate)/100;
                TotalCULoanAmt:=CUInterest+CUPrinciple;
                CCMonthlyPayments:=TotalCULoanAmt/36;
                TotalMonthlyRepayments:= BMonthlyPayments + CCMonthlyPayments + CUMonthlyPayments;
                ApplicantRepayments[Applicant]:=TotalMonthlyRepayments;
                Write ('How much money is spent on groceries?');
                Readln (Groceries);
                Write ('What is the value of the water bill?');
                Readln (Water);
                Write ('What is the value of the electricity bill?');
                Readln (Electricity);
                Write ('What is the value of the telephone bill?');
                Readln (Telephone);
                Write ('How much money is spent on transport');
                Readln (Transport);
                Write ('How many dependents does the applicant have?');
                Readln (Dependents);
                Miscellaneous:= Dependents * DependentAllowance;
                TotalExpenses:= Groceries + Water + Telephone + Electricity + Transport + Miscellaneous;
                ApplicantExepenses:= TotalExpenses;
                FOR Applicant:=1 TO Max DO
           IF ApplicationStatus=Positive THEN
                HalfNetSalary:=NetSalaries[Applicant]*Half;
                Balance:=NetSalaries[Applicant] - (ApplicantRepayments[Applicant] + ApplicantExpenses[Applicant]);
                IF Balance>HalfNetSalaries THEN
                     Writeln ('Approved');
                     FinalApplicationStatus[Applicant]:=CORRECT;
                     Sum:= Sum + 1; ELSE
                     Writeln('Not Approved');
                     FinalApplicationStatus[Applicant]:=WRONG;
      Writeln('THE DETAILS FOR THE APPLICATIONS MADE ARE AS FOLLOWS:');
      Writeln ('Application Details                 Applicant Information');
      FOR Applicant:=1 TO Max DO
            Writeln ('Name of Applicant:        ', ApplicantName[Applicant]:25);
            Writeln ('Housing Community:        ', HousingCommunity[Applicant]:25);
            Writeln ('Initial Application Status', ApplicationStatus[Applicant]:25);
            Writeln ('Final Application Status  ', FinalApplicationStatus[Applicant]:25);
            Writeln ('A total of ', Sum,' applicants were approved for Housing.');
end;

end;

end;

end;

end;

end;

end;

end;

end;

end;

end;

END.

ALI ROOPNARINE

  • Guest
PLEASE HELP VERY URGENT!!!

ALI ROOPNARINE

  • Guest

135 / 22 hclroh~1.pas
 Fatal: Syntax error, ; expected but identifier WRITELN found

Program HCL (input,output);
CONST
Max=45;
Positive='Qualified';
Negative='Not Qualified';
QualifyClark=10000;
QualifyBGarden=7500;
QualifySkyfall=5500;
BTime=3;
ZERO=0;
BRate=10/100;
CCTime=3/2;
CCRate=15/100;
CUTime=3;
DependentAllowance=75;
Half=1/2;
CORRECT='Approved';
WRONG='Not Approved';
TYPE
StringArray=ARRAY[1..Max] OF String;
RealArray=ARRAY[1..Max] OF Real;
IntegerArray=ARRAY[1..Max] OF Integer;
VAR
ApplicantName:StringArray;
HousingCommunity:StringArray;
ApplicantGrossSalary:RealArray;
ApplicantSalaryDeductions:RealArray;
ApplicantSpouse:StringArray;
SpouseGrossSalary:RealArray;
SpouseSalaryDeductions:RealArray;
ApplicationStatus:StringArray;
FinalApplicationStatus:StringArray;
NetSalaries:RealArray;
ApplicantExpenses:RealArray;
ApplicantRepayments:RealArray;
Applicant:Integer;
Name:String;
Housing:String;
GSalary:Real;
Deductions:Real;
Spouse:String;
SpouseSalary:Real;
SpouseDeductions:Real;
TotalGrossSalary:Real;
TotalSalaryDeductions:Real;
NetSalary:Real;
HalfNetSalary:Real;
Balance:Real;
Groceries:Real;
Water:Real;
Telephone:Real;
Electricity:Real;
Transport:Real;
Dependents:Integer;
Miscellaneous:Real;
CCBalance:Real;
CCInterest:Real;
TotalCCAmount:Real;
CCMonthlyPayments:Real;
BPrinciple:Real;
BLoanInterest:Real;
TotalBLoanAmount:Real;
BMonthlyPayments:Real;
CUPrinciple:Real;
CUInterest:Real;
TotalCULoanAmt:Real;
CUMonthlyPayments:Real;
TotalMonthlyRepayments:Real;
Sum:Integer;
BEGIN{MAIN}
      FOR Applicant:=1 TO Max DO
      BEGIN{FOR}
           ApplicantName[Applicant]:='';
           HousingCommunity[Applicant]:='';
           ApplicantGrossSalary[Applicant]:=0;
           ApplicantSalaryDeductions[Applicant]:=0;
           ApplicantSpouse[Applicant]:='';
           SpouseGrossSalary[Applicant]:=0;
           SpouseSalaryDeductions[Applicant]:=0;
           ApplicationStatus[Applicant]:='';
           FinalApplicationStatus[Applicant]:='';
           NetSalaries[Applicant]:=0;
           ApplicantExpenses[Applicant]:=0;
           ApplicantRepayments[Applicant]:=0;
      FOR Applicant:=1 TO Max DO
      BEGIN{FOR}
           Write('What is the name of the applicant?');
           Readln(Name);
           ApplicantName[Applicant]:=Name;
           Write('For which of the following housing communities are applications being made: "ClarkVillas", "BrentwoodGardens" or "SkyfallCourts"?');
           Readln(Housing);
           HousingCommunity[Applicant]:=Housing;
           Write('What is the applicants gross salary?');
           Readln(GSalary);
           ApplicantGrossSalary[Applicant]:=GSalary;
           Write('What are the applicants salary deductions?');
           Readln(Deductions);
           ApplicantSalaryDeductions[Applicant]:=Deductions;
           Write('Does the applicant have a spouse?');
           Readln(Spouse);
           ApplicantSpouse[Applicant]:=Spouse;
           IF Spouse='Yes' THEN
           BEGIN{IF}
                Write('What is the spouses gross salary?');
                Readln(SpouseSalary);
                SpouseGrossSalary[Applicant]:=SpouseSalary;
                Write('What are the spouses salary deductions?');
                Readln(SpouseDeductions);
                SpouseSalaryDeductions[Applicant]:=SpouseDeductions;
           BEGIN{ELSE}
                SpouseSalary:=ZERO;
                SpouseGrossSalary[Applicant]:=SpouseSalary;
                SpouseDeductions:=ZERO;
                SpouseSalaryDeductions[Applicant]:=SpouseDeductions;
      FOR Applicant:=1 TO Max DO
      BEGIN{FOR}
           TotalGrossSalary:=ApplicantGrossSalary[Applicant]+SpouseGrossSalary[Applicant];
           TotalSalaryDeductions:=ApplicantSalaryDeductions[Applicant]+SpouseSalaryDeductions[Applicant];
           NetSalary:= TotalGrossSalary-TotalSalaryDeductions;
           NetSalaries[Applicant]:=NetSalary;
      FOR Applicant:=1 TO Max DO
      BEGIN{FOR}
           IF HousingCommunity[Applicant]='ClarkVillas' THEN
           BEGIN{IF}
                IF NetSalaries[Applicant]>QualifyClark THEN
                BEGIN{IF}
                     Writeln('Qualified');
                     ApplicationStatus[Applicant]:=Positive;
                     Writeln('Not Qualified');
                     ApplicationStatus[Applicant]:=Negative;
                IF HousingCommunity ='BrentWoodGardens' THEN
                IF NetSalaries[Applicant]>QualifyBGarden THEN
                     Writeln('Qualified');
                     ApplicationStatus[Applicant]:=Positive; THEN
                     Writeln('Not Qualified');
                     ApplicationStatus[Applicant]:=Negative;
           IF HousingCommunity[Applicant]:='SkyfallCourts' THEN
                IF NetSalaries[Applicant]>QualifySkyfall THEN
                     Writeln('Qualified');
                     ApplicationStatus[Applicant]:=Positive; THEN
                     Writeln('Not Qualified');
                     ApplicationStatus[Applicant]:=Negative;
      FOR Applicant:=1 TO Max DO
           IF ApplicationStatus[Applicant]:=Postive THEN
                Write('What is the principle loan Amount borrowed from the bank?');
                Readln(BPrinciple);
                Write('What is the outstanding balance on the credit card?');
                Readln(CCBalance);
                Write('What is the principle loan Amount borrowed from the credit union?');
                Readln(CUPriniple);
                BLoanInterest:=(BPrinciple*BTime*BRate)/100;
                TotalBLoanAmt:=BLoanInterest+BPrinciple;
                BMonthlyPayments:=TotalBLoanAmt/36;
                CCInterest:=(CCBalance*CCTime*CCRate)/100;
                TotalCCAmt:=CCInterest+CCBalance;
                CCMonthlyPayents:=TotalCCAmt/18;
                CUInterest:=(CUPrinciple*CUTime*CURate)/100;
                TotalCULoanAmt:=CUInterest+CUPrinciple;
                CCMonthlyPayments:=TotalCULoanAmt/36;
                TotalMonthlyRepayments:= BMonthlyPayments + CCMonthlyPayments + CUMonthlyPayments;
                ApplicantRepayments[Applicant]:=TotalMonthlyRepayments;
                Write ('How much money is spent on groceries?');
                Readln (Groceries);
                Write ('What is the value of the water bill?');
                Readln (Water);
                Write ('What is the value of the electricity bill?');
                Readln (Electricity);
                Write ('What is the value of the telephone bill?');
                Readln (Telephone);
                Write ('How much money is spent on transport');
                Readln (Transport);
                Write ('How many dependents does the applicant have?');
                Readln (Dependents);
                Miscellaneous:= Dependents * DependentAllowance;
                TotalExpenses:= Groceries + Water + Telephone + Electricity + Transport + Miscellaneous;
                ApplicantExepenses:= TotalExpenses;
                FOR Applicant:=1 TO Max DO
           IF ApplicationStatus=Positive THEN
                HalfNetSalary:=NetSalaries[Applicant]*Half;
                Balance:=NetSalaries[Applicant] - (ApplicantRepayments[Applicant] + ApplicantExpenses[Applicant]);
                IF Balance>HalfNetSalaries THEN
                     Writeln ('Approved');
                     FinalApplicationStatus[Applicant]:=CORRECT;
                     Sum:= Sum + 1; ELSE
                     Writeln('Not Approved');
                     FinalApplicationStatus[Applicant]:=WRONG;
      Writeln('THE DETAILS FOR THE APPLICATIONS MADE ARE AS FOLLOWS:');
      Writeln ('Application Details                 Applicant Information');
      FOR Applicant:=1 TO Max DO
            Writeln ('Name of Applicant:        ', ApplicantName[Applicant]:25);
            Writeln ('Housing Community:        ', HousingCommunity[Applicant]:25);
            Writeln ('Initial Application Status', ApplicationStatus[Applicant]:25);
            Writeln ('Final Application Status  ', FinalApplicationStatus[Applicant]:25);
            Writeln ('A total of ', Sum,' applicants were approved for Housing.');
end;

end;

end;

end;

end;

end;

end;

end;

end;

end;

end;

END.

GAN

  • Sr. Member
  • ****
  • Posts: 382
Code: Pascal  [Select][+][-]
  1. IF HousingCommunity[Applicant]:='SkyfallCourts' THEN
  2.                 IF NetSalaries[Applicant]>QualifySkyfall THEN
  3.                      Writeln('Qualified');
  4.                      ApplicationStatus[Applicant]:=Positive; THEN
  5.                      Writeln('Not Qualified');
  6.                      ApplicationStatus[Applicant]:=Negative;

IF THEN IF THEN THEN?

Here's your help:
https://www.tutorialspoint.com/pascal/pascal_tutorial.pdf
Linux Mint Mate (allways)
Zeos 7̶.̶2̶.̶6̶ 7.1.3a-stable - Sqlite - LazReport

molly

  • Hero Member
  • *****
  • Posts: 2330
PLEASE HELP VERY URGENT!!!
There can't be any talk of urgency since you do not seem to grasp the very basics of
a) polite communication (shouting, double posting, repeating request for help within 5 minutes of original post)
b) proper formatting your code (it is lacking)
c) placing your code between code-tags (also lacking)
d) understanding the basic constructs of a pascal program (your code has multiple issues)
e) understanding/handling compiler output (you conveniently left out the first bunch of compiler errors) , also 'inventing' your own error message which does not resemble the actual complete error message.

see also wiki article on forum.

Even if it would be urgent it can't be treated as such. You would have to start at step 1. Take a good look at the documentation about if then else blocks. If that is too complicated then have a look at delphi basic's programming logic and if keyword.

You can't fly a plain before being able read and write  ;D

Handoko

  • Hero Member
  • *****
  • Posts: 5458
  • My goal: build my own game engine using Lazarus
Actually, the code contains more errors than what we guess. On my quick inspection I found it uses same name as the index for multiple level for-do loopings. Testing to compile the code, I got 6 compile time errors. See the image below.

And here is the code after put in to the code tag:

Code: Pascal  [Select][+][-]
  1. Program HCL (input,output);
  2. CONST
  3. Max=45;
  4. Positive='Qualified';
  5. Negative='Not Qualified';
  6. QualifyClark=10000;
  7. QualifyBGarden=7500;
  8. QualifySkyfall=5500;
  9. BTime=3;
  10. ZERO=0;
  11. BRate=10/100;
  12. CCTime=3/2;
  13. CCRate=15/100;
  14. CUTime=3;
  15. DependentAllowance=75;
  16. Half=1/2;
  17. CORRECT='Approved';
  18. WRONG='Not Approved';
  19. TYPE
  20. StringArray=ARRAY[1..Max] OF String;
  21. RealArray=ARRAY[1..Max] OF Real;
  22. IntegerArray=ARRAY[1..Max] OF Integer;
  23. VAR
  24. ApplicantName:StringArray;
  25. HousingCommunity:StringArray;
  26. ApplicantGrossSalary:RealArray;
  27. ApplicantSalaryDeductions:RealArray;
  28. ApplicantSpouse:StringArray;
  29. SpouseGrossSalary:RealArray;
  30. SpouseSalaryDeductions:RealArray;
  31. ApplicationStatus:StringArray;
  32. FinalApplicationStatus:StringArray;
  33. NetSalaries:RealArray;
  34. ApplicantExpenses:RealArray;
  35. ApplicantRepayments:RealArray;
  36. Applicant:Integer;
  37. Name:String;
  38. Housing:String;
  39. GSalary:Real;
  40. Deductions:Real;
  41. Spouse:String;
  42. SpouseSalary:Real;
  43. SpouseDeductions:Real;
  44. TotalGrossSalary:Real;
  45. TotalSalaryDeductions:Real;
  46. NetSalary:Real;
  47. HalfNetSalary:Real;
  48. Balance:Real;
  49. Groceries:Real;
  50. Water:Real;
  51. Telephone:Real;
  52. Electricity:Real;
  53. Transport:Real;
  54. Dependents:Integer;
  55. Miscellaneous:Real;
  56. CCBalance:Real;
  57. CCInterest:Real;
  58. TotalCCAmount:Real;
  59. CCMonthlyPayments:Real;
  60. BPrinciple:Real;
  61. BLoanInterest:Real;
  62. TotalBLoanAmount:Real;
  63. BMonthlyPayments:Real;
  64. CUPrinciple:Real;
  65. CUInterest:Real;
  66. TotalCULoanAmt:Real;
  67. CUMonthlyPayments:Real;
  68. TotalMonthlyRepayments:Real;
  69. Sum:Integer;
  70. BEGIN{MAIN}
  71.       FOR Applicant:=1 TO Max DO
  72.       BEGIN{FOR}
  73.            ApplicantName[Applicant]:='';
  74.            HousingCommunity[Applicant]:='';
  75.            ApplicantGrossSalary[Applicant]:=0;
  76.            ApplicantSalaryDeductions[Applicant]:=0;
  77.            ApplicantSpouse[Applicant]:='';
  78.            SpouseGrossSalary[Applicant]:=0;
  79.            SpouseSalaryDeductions[Applicant]:=0;
  80.            ApplicationStatus[Applicant]:='';
  81.            FinalApplicationStatus[Applicant]:='';
  82.            NetSalaries[Applicant]:=0;
  83.            ApplicantExpenses[Applicant]:=0;
  84.            ApplicantRepayments[Applicant]:=0;
  85.       FOR Applicant:=1 TO Max DO
  86.       BEGIN{FOR}
  87.            Write('What is the name of the applicant?');
  88.            Readln(Name);
  89.            ApplicantName[Applicant]:=Name;
  90.            Write('For which of the following housing communities are applications being made: "ClarkVillas", "BrentwoodGardens" or "SkyfallCourts"?');
  91.            Readln(Housing);
  92.            HousingCommunity[Applicant]:=Housing;
  93.            Write('What is the applicants gross salary?');
  94.            Readln(GSalary);
  95.            ApplicantGrossSalary[Applicant]:=GSalary;
  96.            Write('What are the applicants salary deductions?');
  97.            Readln(Deductions);
  98.            ApplicantSalaryDeductions[Applicant]:=Deductions;
  99.            Write('Does the applicant have a spouse?');
  100.            Readln(Spouse);
  101.            ApplicantSpouse[Applicant]:=Spouse;
  102.            IF Spouse='Yes' THEN
  103.            BEGIN{IF}
  104.                 Write('What is the spouses gross salary?');
  105.                 Readln(SpouseSalary);
  106.                 SpouseGrossSalary[Applicant]:=SpouseSalary;
  107.                 Write('What are the spouses salary deductions?');
  108.                 Readln(SpouseDeductions);
  109.                 SpouseSalaryDeductions[Applicant]:=SpouseDeductions;
  110.            BEGIN{ELSE}
  111.                 SpouseSalary:=ZERO;
  112.                 SpouseGrossSalary[Applicant]:=SpouseSalary;
  113.                 SpouseDeductions:=ZERO;
  114.                 SpouseSalaryDeductions[Applicant]:=SpouseDeductions;
  115.       FOR Applicant:=1 TO Max DO
  116.       BEGIN{FOR}
  117.            TotalGrossSalary:=ApplicantGrossSalary[Applicant]+SpouseGrossSalary[Applicant];
  118.            TotalSalaryDeductions:=ApplicantSalaryDeductions[Applicant]+SpouseSalaryDeductions[Applicant];
  119.            NetSalary:= TotalGrossSalary-TotalSalaryDeductions;
  120.            NetSalaries[Applicant]:=NetSalary;
  121.       FOR Applicant:=1 TO Max DO
  122.       BEGIN{FOR}
  123.            IF HousingCommunity[Applicant]='ClarkVillas' THEN
  124.            BEGIN{IF}
  125.                 IF NetSalaries[Applicant]>QualifyClark THEN
  126.                 BEGIN{IF}
  127.                      Writeln('Qualified');
  128.                      ApplicationStatus[Applicant]:=Positive;
  129.                      Writeln('Not Qualified');
  130.                      ApplicationStatus[Applicant]:=Negative;
  131.                 IF HousingCommunity ='BrentWoodGardens' THEN
  132.                 IF NetSalaries[Applicant]>QualifyBGarden THEN
  133.                      Writeln('Qualified');
  134.                      ApplicationStatus[Applicant]:=Positive; THEN
  135.                      Writeln('Not Qualified');
  136.                      ApplicationStatus[Applicant]:=Negative;
  137.            IF HousingCommunity[Applicant]:='SkyfallCourts' THEN
  138.                 IF NetSalaries[Applicant]>QualifySkyfall THEN
  139.                      Writeln('Qualified');
  140.                      ApplicationStatus[Applicant]:=Positive; THEN
  141.                      Writeln('Not Qualified');
  142.                      ApplicationStatus[Applicant]:=Negative;
  143.       FOR Applicant:=1 TO Max DO
  144.            IF ApplicationStatus[Applicant]:=Postive THEN
  145.                 Write('What is the principle loan Amount borrowed from the bank?');
  146.                 Readln(BPrinciple);
  147.                 Write('What is the outstanding balance on the credit card?');
  148.                 Readln(CCBalance);
  149.                 Write('What is the principle loan Amount borrowed from the credit union?');
  150.                 Readln(CUPriniple);
  151.                 BLoanInterest:=(BPrinciple*BTime*BRate)/100;
  152.                 TotalBLoanAmt:=BLoanInterest+BPrinciple;
  153.                 BMonthlyPayments:=TotalBLoanAmt/36;
  154.                 CCInterest:=(CCBalance*CCTime*CCRate)/100;
  155.                 TotalCCAmt:=CCInterest+CCBalance;
  156.                 CCMonthlyPayents:=TotalCCAmt/18;
  157.                 CUInterest:=(CUPrinciple*CUTime*CURate)/100;
  158.                 TotalCULoanAmt:=CUInterest+CUPrinciple;
  159.                 CCMonthlyPayments:=TotalCULoanAmt/36;
  160.                 TotalMonthlyRepayments:= BMonthlyPayments + CCMonthlyPayments + CUMonthlyPayments;
  161.                 ApplicantRepayments[Applicant]:=TotalMonthlyRepayments;
  162.                 Write ('How much money is spent on groceries?');
  163.                 Readln (Groceries);
  164.                 Write ('What is the value of the water bill?');
  165.                 Readln (Water);
  166.                 Write ('What is the value of the electricity bill?');
  167.                 Readln (Electricity);
  168.                 Write ('What is the value of the telephone bill?');
  169.                 Readln (Telephone);
  170.                 Write ('How much money is spent on transport');
  171.                 Readln (Transport);
  172.                 Write ('How many dependents does the applicant have?');
  173.                 Readln (Dependents);
  174.                 Miscellaneous:= Dependents * DependentAllowance;
  175.                 TotalExpenses:= Groceries + Water + Telephone + Electricity + Transport + Miscellaneous;
  176.                 ApplicantExepenses:= TotalExpenses;
  177.                 FOR Applicant:=1 TO Max DO
  178.            IF ApplicationStatus=Positive THEN
  179.                 HalfNetSalary:=NetSalaries[Applicant]*Half;
  180.                 Balance:=NetSalaries[Applicant] - (ApplicantRepayments[Applicant] + ApplicantExpenses[Applicant]);
  181.                 IF Balance>HalfNetSalaries THEN
  182.                      Writeln ('Approved');
  183.                      FinalApplicationStatus[Applicant]:=CORRECT;
  184.                      Sum:= Sum + 1; ELSE
  185.                      Writeln('Not Approved');
  186.                      FinalApplicationStatus[Applicant]:=WRONG;
  187.       Writeln('THE DETAILS FOR THE APPLICATIONS MADE ARE AS FOLLOWS:');
  188.       Writeln ('Application Details                 Applicant Information');
  189.       FOR Applicant:=1 TO Max DO
  190.             Writeln ('Name of Applicant:        ', ApplicantName[Applicant]:25);
  191.             Writeln ('Housing Community:        ', HousingCommunity[Applicant]:25);
  192.             Writeln ('Initial Application Status', ApplicationStatus[Applicant]:25);
  193.             Writeln ('Final Application Status  ', FinalApplicationStatus[Applicant]:25);
  194.             Writeln ('A total of ', Sum,' applicants were approved for Housing.');
  195. end;
  196.  
  197. end;
  198.  
  199. end;
  200.  
  201. end;
  202.  
  203. end;
  204.  
  205. end;
  206.  
  207. end;
  208.  
  209. end;
  210.  
  211. end;
  212.  
  213. end;
  214.  
  215. end;
  216.  
  217. END.

It seems like a class homework and the TS only care about the urgency to finish it. Well, impatient is a big no for programming. >:D

Those bugs can be solved easily but I will let others who is willing to help impatient student to help.

Bart

  • Hero Member
  • *****
  • Posts: 5575
    • Bart en Mariska's Webstek
Of course this is a homework assignment, and since the deadline most likely is today (april 4th), we will never hear from "ALI ROOPNARINE" again.
At least that's what I predict.

Of course said ALI ROOPNARINE may surprise us and actually do something with the feedback, and show he actually wants to learn and understand programming in pascal, but I wouldn't bet my money on it.

Bart

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11463
  • Debugger - SynEdit - and more
    • wiki
we will never hear from "ALI ROOPNARINE" again.
His status is "Guest" => He closed his forum account.

Bart

  • Hero Member
  • *****
  • Posts: 5575
    • Bart en Mariska's Webstek
So, lock this topic then?

 

TinyPortal © 2005-2018