Results 1 to 2 of 2

Thread: Calculator using a class

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2003
    Posts
    509

    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

  2. #2
    Addicted Member
    Join Date
    Apr 2002
    Location
    California
    Posts
    160

    Calculator

    I wrote this calculator class and interface for you. Let me know if you need help. The file is attached.
    Attached Files Attached Files
    Jason Moore

    Software Engineer, Database Architect, Web Designer

    (C#,VB/NET,ASP/NET,COLDFUSION,JAVASCRIPT,SQL)

    http://www.gatorstudios.com
    [email protected]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width