Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to convert entered string into Uppercase in EZYPASCAL

Status
Not open for further replies.

Teachavibez

IS-IT--Management
Mar 18, 2013
1
0
0
US
Look at the code below how much can you assist me with this i want the compiler to switch the choice to uppercase in the event that when the program runs the user enters a lowercase string see code below:

Program NationalHousingDevelopmentbyAkarieSmith;
Const
Health=930.00;
Housing=0.02;
Education=0.025;
Union=0.01;
Pension=0.05;

Var
Choice:string;
PensionTax:real;
PAYE:real;
HealthTax:real;
HousingTax:real;
EducationTax:real;
CreditUnionTax:real;
PensionPlan:real;
GrossSalary:real;
TotalDeductions:real;
NetSalary:real;
TotalExpenses:real;
MonthlyExpenses:real;
NetIncome:real;
Balance:real;
firstname:String;
lastname:String;
idnumber:integer;
Repayments:real;

Begin
TotalDeductions:=0.00;
NetSalary:=0.00;
TotalExpenses:=0.00;
NetIncome:=0.00;
Balance:=0.00;
GrossSalary:=0.00;

Writeln('%%%%%%%%%%%%%%National Housing Development%%%%%%%%%%%%%%%');
Write('Enter Applicant Id number:');
Readln(idnumber);
While idnumber <>-1 Do
Begin
Write('Enter the Applicant first name:');
Readln(firstname);
Write('Enter the Applicant Last name:');
Readln(Lastname);
Write('Enter His or Her Gross Salary:','$');
Readln(GrossSalary);
Writeln('');
If (GrossSalary)>30000.00 then
PAYE:=(GrossSalary*0.08)
Else
PAYE:= 0.00;
Writeln('Taxable Deductions');
Writeln('__________________');
Writeln('');
Write('PAYE is:','$',PAYE:7:2);
Writeln('');
HealthTax:=Health;
Write('Health Tax is:','$',HealthTax:7:2);
Writeln('');
HousingTax:=(GrossSalary*Housing);
Write('Housing Tax is:','$',HousingTax:7:2);
Writeln('');
EducationTax:=(GrossSalary*Education);
Write('Education Tax is:','$',EducationTax:7:2);
Writeln('');
CreditUnionTax:=(GrossSalary*Union);
Write('Credit Union Tax is:','$',CreditUnionTax:7:2);
Writeln('');
PensionPlan:=(GrossSalary*Pension);
Writeln('Pension Plan is:','$',PensionPlan:7:2);
Writeln('');
TotalDeductions:=(PAYE+HealthTax+HousingTax+EducationTax+CreditUnionTax+PensionPlan);
Writeln('Total Deductions are:','$',TotalDeductions:7:2);
Write('');
NetSalary:=(GrossSalary-TotalDeductions);
Writeln('');
Writeln('Salary after Taxes','$',NetSalary:10:2);
Writeln('');
Writeln('Select your choice of community');
Writeln('Enter ''AL'' for Angels');
Writeln('Enter ''BO''for Boston');
Writeln('Enter ''CL''for Clarendon Courts');
Readln(Choice);

If (Choice)= 'AL' then
Begin
If NetSalary>50000 then
Writeln('You are Qualified for a house in the Angels Community')
Else
Writeln('You are not Qualified for a house in the Angels Community');
End;
Writeln('');
If (Choice)= 'BO' then
Begin
If NetSalary >37500 then
Writeln('You are Qualified for a house in the Boston Gardens Community')
Else
Writeln('You are not Qualified for a house in the Boston Gardens Community');
End;
Writeln('');
If (Choice)= 'CL' then
Begin
If NetSalary > 27500 then
Writeln('You are Qualified for a house in the Clarendon Courts Community')
Else
Writeln('You are not Qualified for a house in the Clarendon Courts Community');
End;
Writeln('');
Write('Enter Monthly Expenses:','$');
Readln(MonthlyExpenses);
Write('Enter Loan Repayments:','$');
Readln(Repayments);
TotalExpenses:=MonthlyExpenses+Repayments;
NetIncome:=NetSalary-TotalExpenses;
Balance:=TotalExpenses/2;
Writeln('');
If NetIncome>Balance then
Writeln('You are approved for a loan')
Else
Writeln('Sorry to inform you but you are not approved for a loan');
Writeln('');
Writeln('Thank you for selecting National Housing Development');
Writeln('');
Writeln('Enter Applicant Id number');
Readln(idnumber);
End;
End.


 
Hi

No idea what is that EZYPASCAL exactly, please provide a link to its online documentation if you are aware of any.

In case EZYPASCAL has SysUtils unit, that should contain an [tt]UpperCase()[/tt] function, so :
Code:
[b]program[/b] NationalHousingDevelopmentbyAkarieSmith[teal];[/teal]

[highlight][b]uses[/b][/highlight]
  [highlight]SysUtils[teal];[/teal][/highlight]

[b]const[/b]
  Health[teal]=[/teal][purple]930.00[/purple][teal];[/teal]

[gray]{ ... }[/gray]

    [b]Writeln[/b][teal]([/teal][green][i]'Enter ''CL''for Clarendon Courts'[/i][/green][teal]);[/teal]
    [b]Readln[/b][teal]([/teal]Choice[teal]);[/teal]
    [highlight]Choice[teal]:=[/teal][COLOR=darkgoldenrod]UpperCase[/color][teal]([/teal]Choice[teal]);[/teal][/highlight]
    [b]if[/b] [teal]([/teal]Choice[teal])=[/teal] [green][i]'AL'[/i][/green] [b]then[/b]
    [b]begin[/b]

[gray]{ ... }[/gray]
The above suggested modifications work in Delphi/Kylix and FreePascal.

Please choose an Indent style and use it consistently. Next time please post your code between [tt][ignore]
Code:
[/ignore][/tt] and [tt][ignore]
[/ignore][/tt] TGML tags.

Feherke.
[link feherke.github.com/][/url]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top