HP Forums

Full Version: Casio FC-200 Financial Consultant
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Just acquired this Casio FC-200 Financial Calculator and this calculator is programmable.

I use to program Casio Programmable calculator before long ago when I was in High School.

Since I just got this calculator so I refreshed my memony and make up two program.

I like to share this and any advice or other who got program listing to share is very welcome.

Code:

P0. Long Division

Procedure: [A for Divident] [B for Divisor]
Answer: Quotient and Remainder

Lbl 1:
?→A: ?→B:
Intg (A ÷ B)◢ 
Ans x B →C:
A-C◢  Goto 1

P1. Roll Two Dice
 
Procedure: [FIX] 1 and Input Seed to [STO] Register [Alpha] on letter [S]
Seed example: .1953767 [STO] [ALPHA] [S]

Lbl 1:
Frac (147 x S) →S:
Frac (699 x S)→R:
Intg (S x 6 + 1) + Intg (R x 6 + 1) ÷ 10 ◢ Goto 1

Gamo 12/15/2020
Just noticed that this particular model it doen't have the [RAN#] function but

it got [Intg] and [Frac]

Gamo
Just added the video clip to sovle for [Tax -] using
Casio FC-200 with the Tax Deduction program.

Youtube link: https://youtu.be/UiQscuKxvXw

Gamo
I've got a couple of programs I use on mine. For readability, I've replaced the colons between statements with newlines. Use colons to separate statements when entering these.

Weekdays
Calculates weekdays/working days within a date range.

Use the DATE key for inputting the two dates, e.g. 12/21/2020/ (yes, you need that final slash). Date A should be the earlier date.

Code:
?→A
?→B
A-B→D
Intg(D÷7)→E
D-7E→M
5E+M→D
1/6/1901/-A
Ans-7Intg(Ans÷7)
Ans=0⇒7
Ans→W
W<7⇒W+M>5⇒D-1→D
W<8⇒W+M>6⇒D-1→D
D+1

Paydown/curtailment savings
Estimates the amount of interest saved over the remaining life of a loan if an extra principle payment of a given size is made. The financial variables should already contain the current parameters of the loan such that FV=0.

Financial variables are written in lowercase. Use RCL to insert them into formulas.

Code:
?→A
pv→P
pv-A→pv
n→N
comp n
Intg n→n
fv→F
comp fv
pmt*N-(pmt*n+fv+fv*i%÷100-A)→S
P→pv
F→fv
N→n
S
Dave Thanks

The Weekday program look very interesting.

From Post #3
Little program to solve for the VAT or Exclusive Tax

Store Tax in Register Alpha [T] if tax is 8% enter 0.08 [STO] [Alpha] [T]

Enter Selling Price including Tax press [EXE] display Price Without Tax [EXE] display Tax Amount.

Program:

Lbl 1: ?→A:
A ÷ (1 + T)◢ // Answer Price without Tax
A - Ans◢ Goto 1 // Answer Tax Amount

Gamo
Hello Dave

I have try your Weekdays program.

Work out ok but not on February.

I try 2/1/2021 to 2/28/2021 program run and answer 21 days

but suppost to be 20 days.

Thanks

Gamo
(12-24-2020 06:02 AM)Gamo Wrote: [ -> ]Hello Dave

I have try your Weekdays program.

Work out ok but not on February.

I try 2/1/2021 to 2/28/2021 program run and answer 21 days

but suppost to be 20 days.

Thanks

Gamo

Well that's interesting! At a glance, I can't figure out why it would do that. The program first calculates the actual number of days between the two dates, then calculates the number of days mod 7 since 1/6/1901 to work out the starting weekday. Must be some edge case I missed, as I don't think this has anything to do with February having fewer days. This was based on a 12C program I wrote; I'll have to see if that one has the same issue.
I just ran a few test cases for dates in/around February, and I seem to be getting correct results (2/1/2021-2/28/2021 is 20, for example). I've double-checked that the program listing is accurate, so you may want to take a look for any typos in your entry. The last few lines that check W and W+M adjust for ranges that start/end on weekends, so you might want to look there first.
Thanks Dave

Just figured out what cause the wrong answer.

I didn't noticed that the calculator Date was set to 360 days mode.

Once I set to 365 the answer is now correct.

Gamo
(12-26-2020 01:14 AM)Gamo Wrote: [ -> ]Thanks Dave

Just figured out what cause the wrong answer.

I didn't noticed that the calculator Date was set to 360 days mode.

Once I set to 365 the answer is now correct.

Gamo

Ah, that would certainly explain it! It's probably throwing off the day-of-week calculation since the number of days since 1/6/1901 would come back different. I never use 360-day mode, so I hadn't even thought of that. Smile
We can make the code more compact, with sign function.

PHP Code:
function sign(x) return x==and or x/abs(xend

function networkdays(AB)      -- assumed date A <= B
    local W 
A%7               -- weekday(A)
    if 
W==0 then W=1A=A+1 end -- A Sun -> Mon
    local D 
B-A
    local E 
floor(D/7)        -- weeks
    
return D-E-sign(D-7*6)    
end 

Update: the code had a bug, when A falls on Sunday.
Shifting it to Monday fixed it, matched open-office networkdays() results.
(12-26-2020 11:31 PM)Albert Chan Wrote: [ -> ]We can make the code more compact, with sign function.

There is definitely no sign function on an fc-200 to take advantage of that though. Wink
(12-26-2020 11:31 PM)Albert Chan Wrote: [ -> ]return D-E-E - sign(D-7*E + W - 6)

If end date falls on Saturday, and start date not on Sunday, sign correction mess goes away.

Example, networkdays between 1/1/2021 (Friday) to 4/1/2021 (Thursday)

Remove the correction term by adjusting end-date to Saturday, 4/3/2022 Sat

D = 31 + 28 + 31 + 2 = 92 days
E = floor(D/7) = 13 weeks

networkdays (1/1/2020 to 4/3/2020) = D-E-E = 66
networkdays (1/1/2020 to 4/1/2020) = 66 - 1 = 65

PHP Code:
function networkdays(AB)      -- assumed date A <= B
    local M 
- (B-1)%7       -- days to Saturday
    local D 
B+A           -- -> Sat
    local E 
floor(D/7)
    if 
D-7*E==6 then D=D-1 end  -- A Sun -> Mon
    
if 1 then D=D-M+1 end
    
return D-E-E
end 
(12-27-2020 12:09 AM)Dave Britten Wrote: [ -> ]There is definitely no sign function on an fc-200 to take advantage of that though. Wink

On CASIOs the simplest SIGN(var) function is (var>0)-(var<0). Maybe it's works on 3650P and similar models. I have checked on my 4000P (seems same as FC models) this causes Syntax error.

Csaba
(12-27-2020 08:49 AM)Csaba Tizedes Wrote: [ -> ]
(12-27-2020 12:09 AM)Dave Britten Wrote: [ -> ]There is definitely no sign function on an fc-200 to take advantage of that though. Wink

On CASIOs the simplest SIGN(var) function is (var>0)-(var<0). Maybe it's works on 3650P and similar models. I have checked on my 4000P (seems same as FC models) this causes Syntax error.

Csaba

Yeah, I don't think Casio changed the relational/comparison operators to work like actual mathematical functions until somewhere around the fx-9750G/cfx-9850G. Prior to that, you could only use them in conjunction with the 'if/then' arrow.
Here is an implementation without sign(), and very fast.
Code:
function networkdays(A, B)  -- assumed date A <= B
    local D = B-A
    local E = floor(D/7)    -- weeks
    A = A%7                 -- weekday(A), range 0 to 6
    B = D-7*E + A           -- weekday(B), range 0 to 12
    if A>0  then A=1 end    -- default, for B<6
    if B==6 then A=A-1 end  -- Sat -> Fri
    if B>6  then A=-1 end   -- remove Sun
    return D-E-E + A
end

Sunday to Saturday is the tricky one, where my previous attempts failed.
FYI, Dave's posted code might failed this too. Please confirm.

lua> networkdays(day(2021,2,28), day(2021,3,5)) -- Sun to Fri
5
lua> networkdays(day(2021,2,28), day(2021,3,6)) -- Sun to Sat
5
lua> networkdays(day(2021,2,28), day(2021,3,7)) -- Sun to Sun
5
Just play around a bit more on this Casio FC-200 Financial Consultant calculator.

So I make a small and very handy program to use for total up a group of items price with different

discount percentage rate on each group.

This program use the Statistic Funtions to help in accumulate each items.

-----------------------------------------------

Discount Percent and Total

1. Following items is 15% discount

12.45, 55.75, 18.50, 10.25 and 75.75

Total = 172.70
Total - (15%) = 146.80
Grand Total = 146.80
-------------------------------------------
2. Following items is 20% discount

127.15, 215, 115 and 215.65

Total = 672.80
Total - (20%) = 538.24
Grand Total = 146.80 + 538.24 = 658.04
-------------------------------------------
Procedure: Fix 2
Setup:
0→M
Mode 6
------------------------------------------
Input each items to [DT] the **[MAR] button**

Select [Prog] # where you put this program

?D input Discount Percent Rate

[EXE] Items Total [EXE] Total subtract Discount [EXE] Grand Total

To input next group of items [Prog] # and same steps as above.
------------------------------------------
Program:
?→D:
T◢ Ans - D%:
Scl◢ Ans + M →M
-----------------------------------------
Remark:
The Apha Letter T in program is the [Σx] function and this function does not
show Summation on the screen in program but Shown as Letter T instead.
To put [Σx] in program enter [ALPHA] [2] and screen shown letter T
Program must activate the Statistic Mode 6 [SD] and program will automatically
clear Satistic Data on each usage so that new group of data is always ready.
-----------------------------------------
Gamo 12/31/2020
This calculator got the Pricing Calculations to find Cost, Price or Margin but no Markup.

This program will will find the Markup when the Margin is known. Even if only the Markup is

known another program will find the Margin and automatically store it.

Program #8 for convert Markup and store into the Margin

Program #9 for Convert Margin to Markup

------------------------------------------------------

Example:

Cost = 8 and Markup = 25 what is the Price?

25 [MAR] [Prog] 8 [EXE] display 20
8 [CST] [COMP] [SEL] [EXE] display answer 10

Answer: Price is 10

--------------------------------------------------

Cost = 15 and Price = 28 what is the Markup?

15 [CST] 28 [SEL] [COMP] [MAR] display 46.43
[PROG] 9 [EXE] display answer 86.67

Answer: Markup is 86.67

-------------------------------------------------
Program:

Program P8

MAR^-1 + .01: Ans^-1: Ans→MAR

Program P9

MAR^-1 - .01: Ans^-1
------------------------------------------------
Remark:

The MAR at the start of each program when enter use [RCL] [MAR]

The ^-1 is the (1/x) this model use [X^-1] the key located at the [SHIFT] [STO]
------------------------------------------------

Gamo 5/2021
Program P8 on previous post can be use as the [Tax -] or Tax Exclusive

[Tax -] is when price is already included tax or VAT and this function is to find

the price not include tax or VAT.

For Example:

This product you pay already included tax is 550 The Tax Rate is 20%
What is the price not include tax?

20 [MAR] [Prog] 8 [EXE] display 16.67 // set up the Tax Rate

550 [SEL] [COMP] [CST] [EXE] display 458.33 // Answer Price without Tax or VAT

To find the Tax Amount:

[RCL] [SEL] - [RCL] [CST] [EXE] display 91.67

-----------------------------------------------------------

You go to other place and got another product for 80
What is the price without tax or VAT?

While the Tax Rate data still in the memory go ahead and continue

80 [SEL] [COMP] [CST] 66.67

To find Tax Amount: [RCL] [SEL] [-] [RCL] [CST] [EXE] display 13.33

Remark:

This Pricing Calculation program can adapted to use for [Tax-] and [Tax+]
The "Tax Rate" have to convert and store to [MAR] by the use of the P8 program.
Use [CST] for [Tax-]
USE [SEL] for [Tax+]

Example:

To find Price with Tax: Price [CST] [COMP] [SEL] [EXE]

To find Price without Tax: Price [SEL] [COMP] [CST] [EXE]

Gamo
This program use for conversion between Markup and Margin since
calculator only have [CST] [SEL] and [MAR] it doesn't have Markup.

First section of this program convert Markup to Margin and Store result to [MAR]
Second section covert Margin to Markup.

Example Usage: Program Store to P0

-------------------------------------------

The Selling Price is $2354 and Markup is 7% What is the Cost?

[Prog] 0 [EXE] display U?

7 [EXE] display 6.54

[AC] 2354 [SEL] [COMP] [CST] [EXE] display answer: 2'200.00

------------------------------------------
Previous Data from last problem is still intact
if Cost is 1100 What is the Selling Price?

1100 [CST] [COMP] [SEL] [EXE] display answer: 1'177.00
------------------------------------------
Convert Margin to Markup:
Margin is 20% What is the Markup?

[Prog] 0 [EXE] display U? // Enter any number except 0 this case I put 1

1 [EXE] display 0.99 ignore this result and press [EXE] display M?

20 [EXE] display answer: 25.00
-----------------------------------------
Program:

?→U: (U-1+.01)-1→MAR◢?→M: (M-1-.01)-1◢

Remark:
U-1 and M-1 and (xxx)-1 is located at [STO] key indicated as X^-1
This code shown as →MAR simply press [MAR]

Gamo 3/2022
Pages: 1 2
Reference URL's