I am trying to write a program for calculating Selling Price (PRC) Cost (CST) Margin (MAR) and Markup (MU)

MU is defined as the difference between PRC and CST, divided by CST.

MAR is defined as the difference between PRC and CST, divided by PRC.

That is: Markup is based on Cost and Margin is based on Selling Price.

I have created the menu for the program using MVAR and VARMENU, and I have programmed finding PRC and MU

given CST and MAR.

I would like the program to find the two remaining variables, given two variables.

Eg. if we have PRC and MAR given, the program finds CST and MU.

Below are the formulas listed for finding the remaining two.

I guess I need some kind of test to find out which variables are filled in when I run the program.

Any suggestions on how to do this?

Calculate Selling Price given Cost and Markup:

CST, ENTER, MU, % +.

Calculate Selling Price given Cost and Margin:

CST, ENTER 1 ENTER, MAR, % - /(division).

Calculate Cost given Selling Price and Markup:

PRC, ENTER 1 ENTER, MU % + /.

Calculate Cost given Selling Price and Margin:

PRC ENTER, MAR, % -.

Calculate Markup given Cost and Selling Price:

CST, ENTER, PRC, %CHG.

Calculate Markup given Margin:

MAR, ENTER, ENTER, 1, X exchange Y, % - /.

Calculate Margin given Selling Price and Cost:

PRC, ENTER, CST, %CHG, CHS

Calculate Margin given Markup:

MU, ENTER, ENTER, 1, X exchange Y, % + /.

Below you find the program listing I already have.

The program can also be used for finding out how much an item cost with or without tax. If an item costs $160 without tax,

set the Cost = 160 and set the Margin = 20 then Markup will show the tax (25%) and PRC = $200 which is the Price including tax.

And vice versa.

Code: Select all

```
01 LBL "SALES"
02 MVAR "PRC"
03 MVAR "CST"
04 MVAR "MAR"
05 MVAR "MU"
06 VARMENU "SALES"
07 STOP
08 EXITALL
09 RCL "CST"
10 1
11 ENTER
12 RCL "MAR"
13 %
14 -
15 /
16 STO "PRC"
17 RCL "MAR"
18 ENTER
19 ENTER
20 1
21 X exchange Y
22 %
23 -
24 /
25 STO "MU"
26 END
```