Math Utilities

General Computer Utilities
NTech
Posts: 33
Joined: Mon May 01, 2017 7:29 pm
Location: USA

Math Utilities

Post by NTech »

Here post Math Utilities. Here are a couple.

Area Calculator

Code: Select all

'Math Tools | Area Calc
'NOTE: 3.14 = PI

pi = 3.14 'HERE IS PI. CHANGE IT TO WHATEVER.

figures$(1) = "Cylinder"
figures$(2) = "Cube"

    nomainwin

    WindowWidth = 550
    WindowHeight = 410

    menu #main, "&Menu", "&About", [about], |, "&Exit", [exit]
    groupbox #main.groupbox9, "Answer", 38, 256, 472, 100
    statictext #main.statictext1, "3-D Object Calculator", 26, 16, 168, 20
    combobox #main.combobox2, figures$(), [selectedFigure], 190, 16, 100, 100
    textbox #main.figure1, 174, 86, 100, 25
    textbox #main.figure2, 174, 121, 100, 25
    textbox #main.figure3, 174, 156, 100, 25
    button #main.button6, "CALCULATE!", [button6Click], UL, 174, 206, 104, 25
    statictext #main.answer, "", 78, 296, 500, 50
    statictext #main.stat1, "", 110, 91, 40, 20
    statictext #main.stat2, "", 110, 126, 40, 20
    statictext #main.stat3, "", 110, 161, 40, 20
    open "3-D Calc" for window as #main
    print #main, "font ms_sans_serif 0 16"
    #main.figure1, "!disable"
    #main.figure2, "!disable"
    #main.figure3, "!disable"
    #main.button6, "!disable"

[main.inputLoop]   'wait here for input event
    wait



[selectedFigure]   'Perform action for the combobox named 'combobox2'
    #main.combobox2, "selection? selected$"
    if selected$ = "Cylinder" then goto [cylinder]
    if selected$ = "Cube" then goto [cube]
    wait


[button6Click]   'Perform action for the button named 'button6'
    if selected$ = "Cylinder" then goto [cylinderCalc]
    if selected$ = "Cube" then goto [cubeCalc]
    wait

[cylinder]
#main.stat1, "Radius"
#main.stat2, "Height"
#main.button6, "!enable"
#main.figure1, "!enable"
#main.figure2, "!enable"
#main.figure3, "!disable"
wait

[cube]
#main.stat1, "Length"
#main.stat2, "Width"
#main.stat3, "Height"
#main.button6, "!enable"
#main.figure1, "!enable"
#main.figure2, "!enable"
#main.figure3, "!enable"
wait

[cylinderCalc]
prompt "Units Of Measure?";unitsOfMeasure$
#main.figure1, "!contents? radius$"
#main.figure2, "!contents? height$"
radius = val(radius$)
height = val(height$)

answer = int((((radius*radius)*pi)*height))

#main.answer, str$(answer) + " " + unitsOfMeasure$ + " cubed"

wait

[cubeCalc]
prompt "Units Of Measure?";unitsOfMeasure$
#main.figure1, "!contents? length$"
#main.figure2, "!contents? width$"
#main.figure3, "!contents? height$"
length = val(length$)
width = val(width$)
height = val(height$)

answer = int(length*width*height)

#main.answer, str$(answer) + " " + unitsOfMeasure$ + " cubed"

wait

[about]
notice "3-D Object Calc" + chr$(13) + "Copyright 2017 N-Tech" + chr$(13) + "Note: 3.14 Is Substituted For Pi." + chr$(13) + "Note: Answer Rounded To The Nearest Integer."
wait

[exit]
close #main
Fractional Multiplyer

Code: Select all

'Math Tools | Fractional Multiplyer


    nomainwin

    WindowWidth = 550
    WindowHeight = 410

    menu #main, "&Menu", "&About", [about], | , "&Exit", [exit]
    textbox #main.numerator1, 78, 56, 100, 25
    statictext #main.statictext2, "---------------------------------------------- X ----------------------------------------------", 54, 91, 900, 20
    textbox #main.denominator1, 78, 111, 100, 25
    textbox #main.numerator2, 302, 56, 100, 25
    textbox #main.denominator2, 302, 116, 100, 25
    button #main.button8, "CALCULATE!", [button8Click], UL, 206, 266, 90, 25

    open "Fractional Multiplyer" for window as #main

    print #main, "font ms_sans_serif 0 16"


[main.inputLoop]   'wait here for input event
    wait



[button8Click]   'Perform action for the button named 'button8'
    #main.numerator1, "!contents? n1$"
    #main.denominator1, "!contents? d1$"
    #main.numerator2, "!contents? n2$"
    #main.denominator2, "!contents? d2$"

    n1 = val(n1$)
    n2 = val(n2$)
    d1 = val(d1$)
    d2 = val(d2$)

    answer1 = int((n1*n2))
    answer2 = int((d1*d2))

    notice "Fractional Calc" + chr$(13) + "Answer Is:" + chr$(13) + str$(answer1) + chr$(13) + "--------------------------------" + chr$(13) + str$(answer2)

    wait

[about]
notice "Fractional Calc" + chr$(13) + "Copyright 2017 N-Tech" + chr$(13) + "Note: Answer Rounded To The Nearest Integer."
wait

[exit]
close #main
end
Have Fun! 8)
8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8) 8)