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:
-
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.
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.
Those bugs can be solved easily but I will let others who is willing to help impatient student to help.
Arefev596 1 / 1 / 0 Регистрация: 15.01.2021 Сообщений: 29 |
||||
1 |
||||
22.04.2021, 17:20. Показов 1993. Ответов 4 Метки нет (Все метки)
На паскале пишу код ровно один день,не понимаю,почему ругается…Буду благодарен за помощь!Программа должна выводить значение Y в зависимости от того, какое X дано. После того,как условие выполняется,значение должно записаться в некий столбец.
__________________
0 |
Programming Эксперт 94731 / 64177 / 26122 Регистрация: 12.04.2006 Сообщений: 116,782 |
22.04.2021, 17:20 |
Ответы с готовыми решениями: Error: Incompatible types: got «Boolean» expected «Int64» Error: Incompatible types: got «Extended» expected «SmallInt» Составить фразу «текстовый редактор» из слов «тесто», «редакция», «мотор», «который»
4 |
Почетный модератор 64272 / 47571 / 32739 Регистрация: 18.05.2008 Сообщений: 115,182 |
|
22.04.2021, 18:26 |
2 |
Ошибка .pas(15,9) Fatal: Syntax error, «;» expected but «ELSE» found Эта ошибка легко исправляется, просто нужно убрать очку сзапятой(
0 |
ValentinNemo 2373 / 775 / 561 Регистрация: 15.01.2019 Сообщений: 2,394 |
||||
22.04.2021, 18:54 |
3 |
|||
Решение
1 |
1 / 1 / 0 Регистрация: 15.01.2021 Сообщений: 29 |
|
22.04.2021, 20:02 [ТС] |
4 |
Полное условие задачи: Миниатюры
0 |
1 / 1 / 0 Регистрация: 15.01.2021 Сообщений: 29 |
|
22.04.2021, 20:07 [ТС] |
5 |
Убрав ; получил: «.pas(14,9) Fatal: Syntax error, «;» expected but «identifier WRITELN» found» Добавлено через 3 минуты
0 |
IT_Exp Эксперт 87844 / 49110 / 22898 Регистрация: 17.06.2006 Сообщений: 92,604 |
22.04.2021, 20:07 |
Помогаю со студенческими работами здесь Составить фразу «программное обеспечение» из слов «программист», «оборот», «анчоус», «измерение»
Ошибка компиляции: Error 85: «;» expected
Построить последовательно применяя методы «отобразить», «сдвинуть», «изменить размеры», «спрятать» иерархии обьектов Искать еще темы с ответами Или воспользуйтесь поиском по форуму: 5 |
Fatal syntax error expected but identifier writeln found
ProgramerForever |
|
||
Опытный Профиль Репутация: нет Возникла проблема с Free Pascal. Не компилирует программы: ошибка » Fatal: Compilation aborted «. Проблема решена: насколько я понял, *.pas файлы надо СОЗДАВАТЬ в программе, а не ОТКРЫВАТЬ их. Вопрос в силе. Всё опять повторилось. Вот, например, начал набрасывать программку:
Const N=10; l:=i-1; |
Код |
kr4.pas(12,3) Error: Illegal expression kr4.pas(13,5) Fatal: Syntax error, «;» expected but «identifier WRITELN» found kr4.pas(0) Fatal: Compilation aborted |
Код |
kr4.pas(0) Fatal: Compilation aborted |
Это сообщение отредактировал(а) ProgramerForever — 15.4.2010, 21:16
Ozzя |
|
||
Шустрый Профиль Репутация: нет |
|||
|
ProgramerForever |
|
||
Опытный Профиль Репутация: нет |
|||
|
Romtek |
|
||
Бывалый Профиль Репутация: нет
Разве в Паскале существует конструкция DO UNTIL? Добавлено через 8 минут и 14 секунд |
|||
|
ProgramerForever |
|
||
Опытный Профиль Репутация: нет |
|||
|
Ozzя |
|
||
Шустрый Профиль Репутация: нет |
|||
|
ProgramerForever |
|
||
Опытный Профиль Репутация: нет |
|||
|
Romtek |
|
||
Бывалый Профиль Репутация: нет
А программа разве ещё неготова? |
|||
|
ProgramerForever |
|
||
Опытный Профиль Репутация: нет
1. Обсуждать и делится взломанными компонентами или программным обеспечением 2. Публиковать ссылки на варез
Если Вам понравилась атмосфера форума, заходите к нам чаще! С уважением, THandle, Rrader, volvo877.
[ Время генерации скрипта: 0.1584 ] [ Использовано запросов: 21 ] [ GZIP включён ] Источник Читайте также: Leeco le max 2 x820 прошивка андроид 11 Adblock |
- Status
- Not open for further replies.
-
#1
Var
AppliName: array[1..99] of String;
SSnum: array[1..99] of Integer;
GSal: array[1..99] of Integer;
TSalD: array[1..99] of Integer;
Name, CC : String;
Rep,Exp, GS,NS,Sum,TSD , YS,SSN,i,C_Amt,PofIncome : integer ;
Begin
Writeln ( ‘Enter applicants who applied for a type of credit card’);
Readln (Rep,Exp,GS,YS,NS,Sum,TSD,SSN,CC,PofInco… ;
While ( Name <> ‘ Stop ‘ ) do
Begin
NS:= GS-TSD ;
Sum:= Exp + Rep ;
PofIncome:=(NS * 0.45);
Begin
If ( GS >4000) AND ( CC = ‘Bronze Card’ ) then
YS:= GS * 12 ;
C_Amt := YS * 0.25;
i:= i + 1;
AppliName := Name;
SSNum := SSN ;
GSal [ i]:= GS ;
TSalD := TSD ;
End ;
Begin
If (GS >= 7500) AND [CC= ‘Gold Card’] then
YS:= GS * 12 ;
C_Amt:= YS * 0.3;
i:= i + 1 ;
AppliName := Name;
SSnum:=SSN;
GSal:=GS;
TSalD:=TSD;
End;
Begin
If (GS>=10,000) AND ( CC = ‘ Platinum Card’) then
YS := GS * 12;
C_Amt: = YS * 0.4;
i:= i + 1;
A ppliName := Name;
SSNum := SSN;
GSal :=GS;
TSalD := TSD;
End if
End if
End if
End While
End.
The five errors are :
1. Error:Incompatible types: got «Boolean» expected «LongInt» — For this line : If (GS >= 7500) AND [CC= ‘Gold Card’] then
2.Error:Incompatible types: got » Set of Boolean» expected » LongInt» — for the same line (If (GS >= 7500) AND [CC= ‘Gold Card’] then )
3.Error:Incompatible types: got «single» expected «smallint» — for C_Amt := YS * 0.25 ; in Bronze Card
4.Error:Incompatible types: got «extended» expected «smallint» for C_Amt := YS * 0.3; in Gold Card
5.Fatal:syntax error , «)» expected but «,» found — (If GS >= 10000) AND [CC= ‘Platinum’] then )
Thanks for any help. I know my program is by no means perfect because I am awful at Pascal and desperately need help on fixing these things. So I am open to anything that will get this program running in Pascal. Thanks.
-
- Feb 10, 2006
-
- 713
-
- 0
-
- 19,460
- 95
-
#2
This: If (GS >= 7500) AND [CC= ‘Gold Card’] then
Should be this: If (GS >= 7500) AND (CC= ‘Gold Card’) then
3 & 4:
You have C_Amt and YS declared as integer yet you are multiplying by a real.
5: there should be no parenthesis at the end of that line.
Your code is hard to read. try indenting where needed. if it was already indented before you copied/pasted, then use the [code ] bbcodes in order to keep the formatting.
-
- Feb 10, 2006
-
- 713
-
- 0
-
- 19,460
- 95
-
#2
This: If (GS >= 7500) AND [CC= ‘Gold Card’] then
Should be this: If (GS >= 7500) AND (CC= ‘Gold Card’) then
3 & 4:
You have C_Amt and YS declared as integer yet you are multiplying by a real.
5: there should be no parenthesis at the end of that line.
Your code is hard to read. try indenting where needed. if it was already indented before you copied/pasted, then use the [code ] bbcodes in order to keep the formatting.
-
- Jan 27, 2006
-
- 724
-
- 0
-
- 19,210
- 64
-
#3
-
- Jan 13, 2011
-
- 4,165
-
- 4
-
- 35,260
- 1,357
-
#4
Program TypeofCreditCard;
Var
AppliName: array[1..99] of String;
SSnum: array[1..99] of Integer;
GSal: array[1..99] of Integer;
TSalD: array[1..99] of Integer;
Name, CC : String;
Rep,Exp, GS,NS,Sum,TSD , YS,SSN,i,C_Amt,PofIncome : integer ;
Begin
Writeln ( 'Enter applicants who applied for a type of credit card');
Readln (Rep,Exp,GS,YS,NS,Sum,TSD,SSN,CC,PofInco... ;
While ( Name <> ' Stop ' ) do
Begin
NS:= GS-TSD ;
Sum:= Exp + Rep ;
PofIncome:=(NS * 0.45);
Begin
If ( GS >4000) AND ( CC = 'Bronze Card' ) then
YS:= GS * 12 ;
C_Amt := YS * 0.25;
i:= i + 1;
AppliName := Name;
SSNum := SSN ;
GSal [ i]:= GS ;
TSalD := TSD ;
End ;
Begin
If (GS >= 7500) AND [CC= 'Gold Card'] then
YS:= GS * 12 ;
C_Amt:= YS * 0.3;
i:= i + 1 ;
AppliName := Name;
SSnum:=SSN;
GSal:=GS;
TSalD:=TSD;
End;
Begin
If (GS>=10,000) AND ( CC = ' Platinum Card') then
YS := GS * 12;
C_Amt: = YS * 0.4;
i:= i + 1;
AppliName := Name;
SSNum := SSN;
GSal :=GS;
TSalD := TSD;
End if
End if
End if
End While
End.
-
- Jan 13, 2011
-
- 4,165
-
- 4
-
- 35,260
- 1,357
-
#5
Appart from the errore already discussed, there are some more:
— there are not «end if» and «end while» operators in Pascal (OK, at least in the popular ones);
— your ReadLn statement probably won’t work — string variables will get empty values. Split it on several Write / ReadLn statements
— you have several arrays, but assignment statements are missing [Index] part of the array, e.g. AppliName := Name;
— you are not checking if one will enter more that 100 applicants
-
#6
By the way, I am using Free IDE Pascal .
-
- Jan 27, 2006
-
- 724
-
- 0
-
- 19,210
- 64
-
#7
-
#8
This is the error — Fatal:Syntax Error, «;» expected but «identifier Writeln found — Source of error- Writeln ( ‘Enter applicants who applied for a type of credit card’);
Is there some sort of documentation about what each error means??I want to learn.
-
- Jul 30, 2008
-
- 1,035
-
- 0
-
- 20,360
- 113
-
#9
-
#10
I’ve done nothing but do the changes I’ve been told to made.
-
- Jan 13, 2011
-
- 4,165
-
- 4
-
- 35,260
- 1,357
-
#11
that is, (omit ‘_’ from example below)
[_code_]
Program something;
…
end.
[_/code_]
-
- Jul 30, 2008
-
- 1,035
-
- 0
-
- 20,360
- 113
-
#13
-
#14
I inserted that beginning then one more error came up and it said
Fatal syntax error, «;’ expected but » BEGIN» found
-
- Jan 13, 2011
-
- 4,165
-
- 4
-
- 35,260
- 1,357
-
#15
On your program:
— Put a «Begin» before first «WriteLn»;
— Put «I := 0» before «while» statement
— change «while» to check that I is less than 100
— change internal «If» to check for «Name <> ‘Stop'»
— Remove last two «End;» before «End.»;
Probably there are more… Change your program, re-post it on PasteBin for further help
-
#16
Will it ever run or come off of this screen that it seems to be stuck on?
-
- Jan 13, 2011
-
- 4,165
-
- 4
-
- 35,260
- 1,357
-
#17
Try pressing <Ctrl>-<Break>, or <Ctrl>-C, to terminate your program. If you have a debugger in your environment, you can try to terminate your program from there as well.
And since we don’t know how your program looks now, noone can tell what will come out of it
-
- Jul 30, 2008
-
- 1,035
-
- 0
-
- 20,360
- 113
-
#18
As the previous poster said, just break into the program. How you do that depends upon your environment.
- Status
- Not open for further replies.
Thread starter | Similar threads | Forum | Replies | Date |
---|---|---|---|---|
B
|
Solved! Apple Community Reload Error | Apps General Discussion | 4 | Jun 14, 2022 |
K
|
Question cache deleted in error | Apps General Discussion | 1 | Apr 25, 2022 |
|
Question How do I update my computer because I have an error? | Apps General Discussion | 0 | Apr 12, 2022 |
C
|
Question Photoshop Elements 2021 error codes 81 and 501 won’t allow installation? How to fix. | Apps General Discussion | 1 | May 5, 2021 |
|
Question i need help in a simple pascal program | Apps General Discussion | 1 | Jun 18, 2020 |
|
Question How to fix“ ERROR-invalid argument/option — ‘Live’ ” in this code? | Apps General Discussion | 0 | Jul 21, 2019 |
|
Question PUBG Lite launcher error | Apps General Discussion | 2 | Jul 1, 2019 |
|
Question Win dos shell syntax error | Apps General Discussion | 2 | Apr 11, 2019 |
I
|
Solved! Getting error 502 Bad Gateway, is it proxy or website itself | Apps General Discussion | 5 | Jan 23, 2019 |
U
|
ASCII in Pascal programming | Apps General Discussion | 4 | Dec 13, 2015 |
A
|
Pascal homework help | Apps General Discussion | 2 | Mar 7, 2015 |
|
need help with pascal programming | Apps General Discussion | 4 | Feb 22, 2014 |
|
why wont this pascal program work? idk | Apps General Discussion | 18 | Dec 13, 2013 |
|
need help with this pascal programming. | Apps General Discussion | 3 | Dec 13, 2013 |
|
why doesnt this pascal program work? | Apps General Discussion | 1 | Dec 7, 2013 |
|
need help with pascal programming? | Apps General Discussion | 2 | Dec 7, 2013 |
|
i need help fixing this pascal program | Apps General Discussion | 13 | Dec 5, 2013 |
L
|
Which programming languages will I need to learn as an actuary? | Apps General Discussion | 2 | Dec 12, 2012 |
M
|
** A CHALLENGE ** UCSD P-sytem Pascal ** | Apps General Discussion | 7 | Oct 15, 2010 |
P
|
pascal quation.. | Apps General Discussion | 7 | Nov 13, 2008 |
- Advertising
- Cookies Policies
- Privacy
- Term & Conditions
- Topics