## Tuesday, March 13, 2018

### HP Prime: Car Payment and Affordability

HP Prime:  Car Payment and Affordability

Introduction

The two programs presented here tackle common financial questions of purchasing automobiles.  (or other equipment).   CARPMT calculates what would be the monthly payment, while CARAFFORD calculates the sticker price that the buyer can afford.  The variables that are considered are:

N = number of monthly payments, typically 48, 60, or 72 (for 4, 5, or 6 year term, respectively)
I = annual interest rate of the buyer can get, hopefully this rate is low
S = sales tax rate
D = discount rate, as car dealers tend to off discounts
W = down payment (enter as negative)

Firmware 13441 is used and the Finance app functions TvmPMT and TvmPV are used.  For the finance functions, they are designated with the “Finance.” prefix to allow usage of the program on any app.   TVM cash flow convention is retained, outflows (payments) are entered as negative while inflows (in this case the financing loan) are treated as positive.

HP Prime Program CARPMT

EXPORT CARPMT(N,I,P,S,D,W)
BEGIN
// enter down pmt as negative
// 2018-03-12 EWS
// Function Setup
// no. payments,
// annual interest, price,
// sales tax, discount, down pmt

LOCAL X;
X:=P*(1+S/100)*(1-D/100)+W;
// Finance app
X:=
Finance.TvmPMT(N,I,X,0,12);

RETURN ROUND(X,2);

END;

Example:
Term:  60 months
Interest Rate: 4.5%
Sticker Price: 18995
Sales Tax: 9.5%
Discount Rate: 10%
Down Payment: \$1000

CARPMT(60,4.5,18995,9.5,10,-1000)

Result:  -330.35

Payment is \$330.35

HP Prime Program CARAFFORD

EXPORT CARAFFORD(N,I,X,S,D,W)
BEGIN
// pmt and down pmt enter
// as negative
// 2018-03-12 EWS
// Function Setup
// no pmts, annual interest,
// payment (as pqsitive),
// sales tax, discount, down pmt

LOCAL P;
// Finance app
P:=
Finance.TvmPV(N,I,X,0,12);
// calculating affordable price
P:=(P-W)/((1+S/100)*(1-D/100));

RETURN ROUND(P,2);

END;

Example:
Term:  60 months
Interest Rate: 4.8%
Payment:  \$350.00
Sales Tax: 9.5%
Discount Rate: 10%
Down Payment: \$500

CARAFFORD(60,4.8,-350,9.5,10,-500)

Result:  \$19,418.67
The car that can be afforded is \$19,418.67 (before sales tax and discounts).

As day of this post is on Pi-Day Eve, Happy Pi Day on March 14!  π = 3.141592653…

Eddie

This blog is property of Edward Shore