# create a Fraction calculator program. More in depth!

Page 1 of 1

## 0 Replies - 477 Views - Last Post: 01 October 2012 - 09:14 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=293838&amp;s=dff1f1fcd01d64d2a7d8aacf350b688b&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 kikiskia

• New D.I.C Head

Reputation: 0
• 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

 .related ul { list-style-type: circle; font-size: 12px; font-weight: bold; } .related li { margin-bottom: 5px; background-position: left 7px !important; margin-left: -35px; } .related h2 { font-size: 18px; font-weight: bold; } .related a { color: blue; }