0 Replies - 317 Views - Last Post: 01 October 2012 - 09:14 AM Rate Topic: -----

#1 kikiskia  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 28
  • Joined: 10-September 11

create a Fraction calculator program. More in depth!

Posted 01 October 2012 - 09:14 AM

You need to create a Fraction calculator program. You need to create a Fraction class to represent fraction objects and a FractionCalculator class that will perform operations on fractions. Make sure you use input validation, so your program doesn’t crash.

Requirements for Class Components:

You need to create a Fraction class that stores information regarding fractions.
The class should have private instance fields for this class called numerator and denominator.

You need properties to get/set these values.
Name them Numerator and Denominator.

The class needs a constructor that accepts two strings that are used to construct a fraction object: one for the numerator, and one for the denominator.

The class needs a constructor that accepts two integers that are used to construct a fraction object.

You need an Equals() method that returns true when a fraction passed into the method is equal to the fraction object the method was called upon.

You need a ToString() method that returns a string representation of a fraction.


This is my code. I am alittle lost so if someone can help me or guide me in the right direction. Please help me fix my code and add the things needed!!

Public Class Form1

    Private Class Fraction
        Private Numerator1 As String
        Private Denominator1 As String
        Public Sub New()
        End Sub
        Public Sub New(num As String)
            Me.num = Numerator
        End Sub
        Public Sub New(denominators As String)
            Me.Denominator = denominators
        End Sub
        Dim num1 As New Fraction
        Dim denominators As New Fraction


        Public Property Numerator() As String
            Get
                Return Numerator1
            End Get
            Set(ByVal value As String)
                Numerator1 = value
            End Set
        End Property

        Public Property Denominator() As String
            Get
                Return Denominator1
            End Get
            Set(ByVal value As String)
                Denominator1 = value
            End Set
        End Property



    End Class



Is This A Good Question/Topic? 0
  • +

Page 1 of 1