Thursday, July 14, 2016

HP 12C Programming Part II: Weekday Number, Gross Up Calculation

HP 12C Programming Part II:  Weekday Number, Gross Up Calculation

Here is Part II of the HP 12C programming series.

HP 12C Weekday Number

This program determines (“extracts” in a sense) the workday number of a given date.  I have this program set to work properly after January 6, 1800, which was a Monday.  The results translate as follows:

1 = MON
2 = TUE
3 = WED
4 = THU
5 = FRI
6 = SAT
7 = SUN

The HP 12C is assumed to be use the United States date format (M.DY – [ g ] [ 5 ]).

Program:
STEP
CODE
KEY
COMMENT
01
1
1

02
48
.
Decimal point
03
0
0

04
6
6

05
1
1

06
8
8

07
34
X<>Y

08
43, 26
ΔDYS
Days between dates function
09
7
7

10
10
÷

11
43, 24
FRAC

12
7
7

13
20
*

14
1
1

15
40
+

16
43, 33, 00
GTO 00


Input:  Date in MM.DDYYYY format, [R/S]
Result: Date indicator

Test 1: May 22, 1999.
Input:  5.221999 [R/S]
Result:  6 (Saturday)

Test 2:  July 11, 2016

Result:  1 (Monday)

HP 12C Gross Up Calculation

We have to pay a person, and the person lives outside of your tax jurisdiction (outside of your state or the United States).  Tax withholding may be required.  However, you or someone else that is requesting the payment wants the face amount.  In order to give the face amount and fulfill the tax requirement at the same time, the payment is must be grossed up.

Link to the Investopedia article:  http://www.investopedia.com/terms/g/gross-up.asp

Formulas:
Gross up Amount = Face Amount/(1 – Tax Rate%)
Amount of Tax = Gross up Amount – Face Amount

Program:
STEP
CODE
KEY
COMMENT
01
44, 0
STO 0
Store Tax Rate
02
34
X<>Y

03
44, 1
STO 1
Store Face Value
04
45, 0
RCL 0

05
1
1

06
25
%

07
1
1

08
30
-

09
16
CHS

10
45, 1
RCL 1

11
34
X<>Y

12
10
÷

13
31
R/S
Display Gross up Amount
14
45, 1
RCL 1

15
30
-

16
43, 33, 00
GTO 00
Display Tax

Input:  face value, [R/S], tax rate, [R/S]
Result: gross amount, [R/S], tax

Part 1:  Face Value:  $1,000, Tax Rate:  30%.
Input:  1000 [R/S], 30 [R/S]
Result:  1428.57 [R/S], 428.57 [R/S]
The gross up amount is $1,428.57 (total amount to be paid), and corresponding tax is $428.57.

Part 2:  Face Value:  $2,500, Tax Rate:  7%.
Input:  2500 [R/S], 7 [R/S]
Result:  2688.17 [R/S], 188.17 [R/S]
The gross up amount is $2,688.17 (total amount to be paid), and corresponding tax is $188.17.


Another note, I will be taking some time off and plan to be back within two weeks.  I want to thank all of you readers and those who commentators, this blog would not be the success that it is without you.  Enjoy summer (or winter if you are in the Southern Hemisphere) and we'll talk again.  

Eddie

This blog is property of Edward Shore, 2016. 

  Casio fx-7000G vs Casio fx-CG 50: A Comparison of Generating Statistical Graphs Today’s blog entry is a comparison of how a hist...