|
-
Jan 21st, 2004, 07:16 AM
#1
Thread Starter
Fanatic Member
Calculator using a class
I am attempting to create a simple calculator system using a class.
I have some code at the momment but unsure where to go from here.
The properties in the class should set to write only for the firstnumber,secondnumber and opearation, but the RESULT should be readonly-How can i do this?
The user should select from a list of operators, +,-,*,/,^ using a listbox onthe form.
The input of the two numbers should be done using an input box.
The output should go to a label box.
This is what i have so far, can someone help me finish it off please.-I only have the class at the momment but even that is incomplete.
I have no properties and no method.
Public Class Class1
Private fFirstNumber As Single
Private fSecondNumber As Single
Private cOperation As Char
Private Result As String
Sub New()
fFirstNumber = "Enter First Number"
fSecondNumber = "Enter second Number"
cOperation = "Select Operator"
Result = ""
End Sub
Sub New(ByVal firstnum As Single, ByVal secondnum As Single, _
ByVal operation As Char, ByVal resulting As String)
fFirstNumber = firstnum
fSecondNumber = secondnum
cOperation = operation
Result = resulting
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|