You are on page 1of 16

PROGRAMMING SECTION

Problem Statement: This program accepts the profit for the year, loan amount, interest rate, and
the number of years and calculates the monthly payments, interest and total repayment.

VARIABLE DEFINITIONS
Count Count specifies how many times a loop can be
executed. It can be used in the FOR....DO loop,
which is an automated loop with automated
increments.
Profit The amount of money Mr. Green earned from
the business during one year
Loan_Amt The amount of money to be borrowed from a
potential bank.
Bank_Name The name of the prospective bank where the
loan will be obtained
Interest_Rate The percentage at which the interest is
calculated on a loan
NoOfYears the number of years Mr. Green will take to
repay the loan to the prospective bank in
monthly installments
Monthly_Payment The monthly payment made to the bank to
cover the loan's entire repayment amount.
Interest The profit made by a bank on the repayment of
a loan. Is expressed as a percentage of the loan
amount.
Total_Repayment The total amount to be repaid, including the
interest on the loan.
Pseudocode_BankLoanforMr.Green

Variables

Count: integer
Profit, Loan_Amt, Interest_Rate, NoOfYears, Monthly_Payment, Interest,
Total_Repayment: real
Bank_Name: string

Begin
Count=1
Prompt the user for the Profit for the year
Read Profit
IF(Profit *2) > 12,000 THEN
Loan_Amt= Profit *2
ELSE
Loan_Amt= 12,000
ENDIF
FOR Count= 1 TO 3 DO
Prompt the user for the bank name, Bank_Name
Prompt the user for the interest rate, Interest_Rate
Prompt the user the number of years to repay loan, NoOfYears
Interest= (Loan_Amt* Interest_Rate* NoOfYears)/100
Monthly_Payment= (Loan_Amt+ Interest)/(NoOfYears*12)
Total_Repayment= (Loan_Amt+ Interest)
Write Bank_Name
Write Interest
Write Monthly_Payment
Write Total_Repayment
END FOR
End.
TEST DATA 1

Profit Bank_Name Interest_Rate NoOfYears


15300 Royal 7.25 3
First Citizens 6.75 4
Scotia 6.45 5

TRACE TABLE 1

Count Profit Loan Bank Name Interest No Interest Monthly Total


Amount Rate Of Payment Repayment
Years
1 - - - - - - - -
1 15300 - - - - - - -
1 15300 30600 - - - - - -
1 15300 30600 Royal 7.25 3 6655.5 1034.88 37255.5
2 15300 30600 First Citizens 6.75 4 8262 809.63 38862
3 15300 30600 Scotia 6.45 5 9868.5 674.48 40468.5
TEST DATA 2

Profit Bank_Name Interest_Rate NoOfYears


18000 Royal 7.25 3
First Citizens 6.75 4
Scotia 6.45 5

TRACE TABLE 2

Count Profit Loan Bank Name Interest No Interest Monthly Total


Amount Rate Of Payment Repayment
Years
1 - - - - - - - -
1 18000 - - - - - - -
1 18000 36000 - - - - - -
1 18000 36000 Royal 7.25 3 7830 1217.5 43830
2 18000 36000 First Citizens 6.75 4 9720 952.5 45720
3 18000 36000 Scotia 6.45 5 11610 793.5 47610
TEST DATA 3

Profit Bank_Name Interest_Rate NoOfYears


20000 Royal 7.25 3
First Citizens 6.75 4
Scotia 6.45 5

TRACE TABLE 3

Count Profit Loan Bank Name Interest No Interest Monthly Total


Amount Rate Of Payment Repayment
Years
1 - - - - - - - -
1 20000 - - - - - - -
1 20000 40000 - - - - - -
1 20000 40000 Royal 7.25 3 8700 1352.78 48700
2 20000 40000 First Citizens 6.75 4 10800 1058.33 50800
3 20000 40000 Scotia 6.45 5 12900 881.67 52900
TEST DATA 4

Profit Bank_Name Interest_Rate NoOfYears


16000 Royal 7.25 3
First Citizens 6.75 4
Scotia 6.45 5

TRACE TABLE 4

Count Profit Loan Bank Name Interest No Interest Monthly Total


Amount Rate Of Payment Repayment
Years
1 - - - - - - - -
1 16000 - - - - - - -
1 16000 32000 - - - - - -
1 1000 32000 Royal 7.25 3 6960 1082.22 38960
2 16000 32000 First Citizens 6.75 4 8640 846.67 40640
3 16000 32000 Scotia 6.45 5 10320 705.33 42320
TEST DATA 5

Profit Bank_Name Interest_Rate NoOfYears


23000 Royal 7.25 3
First Citizens 6.75 4
Scotia 6.45 5

TRACE TABLE 5

Count Profit Loan Bank Name Interest No Interest Monthly Total


Amount Rate Of Payment Repayment
Years
1 - - - - - - - -
1 23000 - - - - - - -
1 23000 46000 - - - - - -
1 23000 46000 Royal 7.25 3 10005 1555.69 56005
2 23000 46000 First Citizens 6.75 4 12420 1217.08 58420
3 23000 46000 Scotia 6.45 5 14835 1013.92 60835
PASCAL PROGRAM

Program Bank_Operations (input,output); { this program accepts the profit, loan amount,
interest rate and the number of years to repay the loan and calculates the interest, monthly
payment and total repayment}

Var

Count: integer;

Profit, Loan_Amt, Interest_Rate, NoOfYears, Monthly_Payment, Interest,


Total_Repayment: real;

Bank_Name: string;

Begin { start of the program}

Count:= 1;

writeln('Enter the profit for the year');

readln(profit);

IF (profit * 2)> 12000 THEN

Loan_Amt:= (profit * 2)

ELSE

Loan_Amt:= 12000;

FOR Count:= 1 to 3 DO begin { this loop executes each bank 3 times. Begin is the start of the
FOR...DO loop}

writeln('Enter the name of the bank');

readln(Bank_Name);

writeln('Enter the interest rate');

readln(Interest_Rate);

writeln('Enter the number of years to repay the loan');

readln(NoOfYears);

Interest:= (Loan_Amt * Interest_Rate * NoOfYears)/100;


Monthly_Payment:= (Loan_Amt + Interest)/(NoOfYears * 12);

Total_Repayment:= (Loan_Amt + Interest);

writeln('Bank Name is ', Bank_Name);

writeln('Interest is $', Interest:4:2);

writeln('Monthly Payment is $', Monthly_Payment:4:2);

writeln('Total Repayment is $', Total_Repayment:4:2);

writeln;

End; { end of the FOR…DO loop}

End. { end of the program}


WORKING PASCAL PROGRAM
PASCAL PROGRAM OUTPUT

Test 1 Profit- 15300


Test 2 Profit- 18000
Test 3 Profit- 20000
Test 4 Profit- 16000
Test 5 Profit- 23000
RECOMMENDATION

We recommend that Mr. Green choose the option of “ Royal Bank” since it has the least Total
Repayment, therefore being the cheapest.

You might also like