Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set r to return as text
- display dialog "Choose an operation" buttons {"Add", "Subtract", "Other"} with title "Calculator"
- set opr to button returned of the result
- -- You pressed add
- if opr is "Add" then
- display dialog "Enter your first number in the equation" default answer "" with title "First Number"
- set FirstNumber to text returned of the result
- display dialog "Your curent equation is " & FirstNumber & "+?" & r & "Enter your second number" default answer "" with title "Second Number"
- set SecondNumber to text returned of the result
- display dialog "Your equation is " & FirstNumber & "+" & SecondNumber & r & r & "Answer: " & FirstNumber + SecondNumber buttons {"OK"}
- -- you picked subtract
- else if opr is "Subtract" then
- display dialog "Enter your fisrt number in the equation" default answer "" with title "First Number"
- set FirstNumber to text returned of the result
- display dialog "Your curent equiation is" & FirstNumber & "-?" & r & "Enter your second number" default answer "" with title "Second Number"
- set SecondNumber to text returned of the result
- display dialog " your equation is" & FirstNumber & "-" & SecondNumber & r & r & "Answer: " & FirstNumber - SecondNumber buttons {"OK"}
- else
- display dialog "Pick your operation" buttons {"Multiply", "Divide"}
- set X to button returned of the result
- -- You picked multiply
- if X is "Multiply" then
- display dialog "Enter your first number in the equation" default answer "" with title "First Number"
- set FirstNumber to text returned of the result
- display dialog "Your curent equation is" & FirstNumber & "*?" & r & "Enter your second number" default answer "" with title "Second Number"
- set SecondNumber to text returned of the result
- display dialog "Your equation is" & FirstNumber & "*" & SecondNumber & r & r & "Answer:" & FirstNumber * SecondNumber buttons {"OK"}
- else
- display dialog "Enter your first number in the equation" default answer "" with title "First Number"
- set FirstNumber to text returned of the result
- display dialog "Your curent equation is" & FirstNumber & "/?" & r & "Enter your second number" default answer "" with title "Second Number"
- set SecondNumber to text returned of the result
- display dialog "Your equation is" & FirstNumber & "/" & SecondNumber & r & r & "Answer:" & FirstNumber / SecondNumber buttons {"OK"}
- end if
- end if
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement