All,
I use chatGPT+. I asked it to write a multivalue basic program to calculate a loan payment. This is the result.
0001: PROGRAM LoanPayment
0002: PRINT "Enter the loan amount: ";
0003: INPUT LoanAmount
0004: PRINT "Enter the annual interest rate (as a percentage): ";
0005: INPUT AnnualInterestRate
0006: PRINT "Enter the loan term in years: ";
0007: INPUT LoanTerm
0008:
0009: MonthlyInterestRate = (AnnualInterestRate / 100) / 12
0010: NumberOfPayments = LoanTerm * 12
0011:
0012: IF MonthlyInterestRate = 0 THEN
0013: MonthlyPayment = LoanAmount / NumberOfPayments
0014: ELSE
0015: MonthlyPayment = LoanAmount * MonthlyInterestRate * (1 + MonthlyInterestRate) ^ NumberOfPayments / ((1 + MonthlyInterestRate) ^ NumberOfPayments - 1)
0016: END
0017:
0018: PRINT "Monthly payment: ", MonthlyPayment 'R2'
0019: END
It took a bit of cajoling but within three corrections this was the end result.
Does anyone have a BNF or ANTLR definition of the BASIC language? I'd like to feed it into chatGPT and see how it improves the coding capability.
------------------------------
Jon Kristofferson
Pick Programmer
Snap-on Credit LLC
Libertyville IL US
------------------------------



