- Joined
- Feb 11, 2007
- Sythe Gold
- 0
- Messages
- 1,478
I know that its simple math, but this streamlines the process into 4 simply entry fields. This is wrote in BASIC, not VB, just simply basic. I wrote it in a program called Just BASIC, you can try it in any other but i havent so no guarantees. This code is for anyone who wants to improve and add on. I would like fancy it up and possibly add some other features.
Code:
nomainwin
WindowWidth = 300
WindowHeight = 230
UpperLeftX = 200
UpperLeftY = 150
button #profit.calc, "Calculate", [calcClicked], LR, 60, 10
textbox #profit.field1, 40, 15, 200, 25
textbox #profit.field2, 40, 50, 200, 25
textbox #profit.field3, 40, 85, 200, 25
textbox #profit.field4, 40, 120, 200, 25
open "Profit" for window as #profit
print #profit, "trapclose [quit]"
[start]
print #profit.field1, "Total Money"
print #profit.field2, "Number Of Items Bought"
print #profit.field3, "Price Bought For"
print #profit.field4, "Price Sold For"
wait
[calcClicked]
print #profit.field1, "!contents? tmoney"
print #profit.field2, "!contents? ibought"
print #profit.field3, "!contents? pbought"
print #profit.field4, "!contents? psold"
let totalpaid = ibought * pbought
let endmoney = psold * ibought
let profit = endmoney - totalpaid
let profitpercent = (profit / tmoney) * 100
goto [profitNotice]
[profitNotice]
notice "Your Profit In Gold is: "; profit
notice "Your Percentage Of Profit is: "; profitpercent; "%"
confirm "Calculate Another? (Y/N)?"; play$
if instr("YESyes", play$) then goto [start]
[quit]
close #profit
end


