he is the new calculator with the power of 10 lines corrected and a main menu:
=============================================
Set wshshell=wscript.createobject("wscript.shell")
Dim msg,input
msg = "Choose System of Equations:" & vbCR
msg = msg & "" & vbCR
msg = msg & "1. Multiplication " & vbCR
msg = msg & "2. Addition " & vbCR
msg = msg & "3. Division " & vbCR
msg = msg & "4. Subtraction " & vbCR
msg = msg & "5. Absolute Value " & vbCR
msg = msg & "6. Raising to a Power" & vbCR
input = InputBox(msg,"Calculator Main Menu")
Select Case input
case "1"
Dim a, b, sum
a=inputbox("Input your first number to be multiplied.", "Multiplication- First Number", "Enter your number")
b=inputbox("Input your second number to be multiplied.", "Multiplication-Second Number", "Enter your number")
if not isnumeric (a) then
a = false
end if
If a = vbCancel then
wscript.quit
end if
if not isnumeric (b) then
b = false
end if
If b = vbCancel then
wscript.quit
end if
c=msgbox("Your Answer: "& a * b, vbInformation, "Product")
case "2"
a=inputbox("Input your first value to be added.", "Addition- First Value", "Enter your number")
b=inputbox("Input your second value to be added.", "Addition- Second Value", "Enter your number")
if not isnumeric (a) then
a = false
end if
If a = vbCancel then
wscript.quit
end if
if not isnumeric (b) then
b = false
end if
If b = vbCancel then
wscript.quit
end if
sum= Cdbl (a) + Cdbl(b)
MsgBox "Your Answer: " & sum, vbInformation, "Sum"
case "3"
a=inputbox("Input your first number to be divided.", "Division- First Number", "Enter your number")
b=inputbox("Input your second number to be divided.", "Division-Second Number", "Enter your number")
if not isnumeric (a) then
a = false
end if
If a = vbCancel then
wscript.quit
end if
if not isnumeric (b) then
b = false
end if
If b = vbCancel then
wscript.quit
end if
c=msgbox("Your Answer: "& a / b, vbInformation, "Quotient")
case "4"
a=inputbox("Input your first value to be Subtracted.", "Subtraction- First Value", "Enter your number")
b=inputbox("Input your second value to be Subtracted.", "Subtraction- Second Value", "Enter your number")
if not isnumeric (a) then
a = false
end if
If a = vbCancel then
wscript.quit
end if
if not isnumeric (b) then
b = false
end if
If b = vbCancel then
wscript.quit
end if
difference= Cdbl (a) - Cdbl(b)
MsgBox "Your Answer: " & difference, vbInformation, "Difference"
case "5"
a=inputbox("Input the the value you want the absolute value of.", "Absolute Value- Input Value", "Enter your number")
if not isnumeric (a) then
a = false
end if
If a = vbCancel then
wscript.quit
end if
msgbox "Your Answer: " & abs(a), vbInformation, "Absolute Value"
case "6"
a=inputbox("Input the the value you want raised to a power.", "Base Number- Input Value", "Enter your number")
if not isnumeric (a) then
a = false
end if
If a = vbCancel then
wscript.quit
end if
b=inputbox("Input your the desired exponent as the second value (any value from 0 to 10).", "Exponent- Second Value", "Enter your number")
if not isnumeric (b) then
b = false
end if
If b = vbCancel then
wscript.quit
end if
if b = 0 then
msgbox "Your Answer: " & 1, vbInformation, "Number Raised to an Exponent"
end if
if b = 1 then
msgbox "Your Answer: " & a, vbInformation, "Number Raised to an Exponent"
end if
if b = 2 then
msgbox "Your Answer: " & a * a, vbInformation, "Number Raised to an Exponent"
end if
if b = 3 then
msgbox "Your Answer: " & a * a * a, vbInformation, "Number Raised to an Exponent"
end if
if b = 4 then
msgbox "Your Answer: " & a * a * a * a, vbInformation, "Number Raised to an Exponent"
end if
if b = 5 then
msgbox "Your Answer: " & a * a * a * a * a, vbInformation, "Number Raised to an Exponent"
end if
if b = 6 then
msgbox "Your Answer: " & a * a * a * a * a * a, vbInformation, "Number Raised to an Exponent"
end if
if b = 7 then
msgbox "Your Answer: " & a * a * a * a * a * a * a, vbInformation, "Number Raised to an Exponent"
end if
if b = 8 then
msgbox "Your Answer: " & a * a * a * a * a * a * a * a, vbInformation, "Number Raised to an Exponent"
end if
if b = 9 then
msgbox "Your Answer: " & a * a * a * a * a * a * a * a * a, vbInformation, "Number Raised to an Exponent"
end if
if b = 10 then
msgbox "Your Answer: " & a * a * a * a * a * a * a * a * a * a, vbInformation, "Number Raised to an Exponent"
end if
End Select