• Log in or sign up for an account here: https://www.sythe.org/login

Basic Profit Calculating Program

Joined
Feb 11, 2007
Sythe Gold
0
Messages
1,478
I have made this simple program for the use of anyone, the code is open for improvements and I myself may improve on it. It is coded in BASIC in a program called Just Basic. (Found at www.justbasic.com for free.) I want to add more options and more functionality but for now this is it:

Code:
    nomainwin

    WindowWidth = 300
    WindowHeight = 250
    UpperLeftX = 200
    UpperLeftY = 150
    button #profit.calc, "Calculate", [calcClicked], LR, 60, 10
    statictext #profit.desc, "NOTE: This program assumes you sell all of the items bought.", 40, 145, 200, 25
    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
 
Member of the Month Winner
Sythe's 10th Anniversary
Who still codes in BASIC?
Next to nobody.

Move on to something else or you'll regret it later if you aim to continue programming as either a hobby or a career. BASIC is only good for basic things (no pun intended). You can't use it for much else than what you've got there unless you're using something like Microsoft's Visual Basic on the .Net platform. I recommend moving on to something slightly more complicated yet quite a bit more useful. C#, Java or even Python perhaps.
 
Next to nobody.

Move on to something else or you'll regret it later if you aim to continue programming as either a hobby or a career. BASIC is only good for basic things (no pun intended). You can't use it for much else than what you've got there unless you're using something like Microsoft's Visual Basic on the .Net platform. I recommend moving on to something slightly more complicated yet quite a bit more useful. C#, Java or even Python perhaps.

Basic as in Visual basic?
 
I did this cause I had the program sitting around on my flash drive, I had to reset my PC cause it was crashing and I havent Got VB or the Microsoft C# on my Laptop yet.
 
Runescape Gamblingrunescape gambling
Back
Top