I'm doing a fraction calculator and I'm trying to add 2 fractions when I put in my fractions it just adds my Whole numbers only and nothing else if my fraction is 2 3/4 + 2 3/5 it add the whole numbers and outputs 4

```
var firstStep = firstDenomInTextField! * firstWholeInTextField! / firstDenomInTextField!
var secondStep = firstStep + firstNumInTextField! / firstDenomInTextField!
var thirdStep = secondDenomInTextField! * secondWholeInTextField! / secondDenomInTextField!
var fourthStep = thirdStep + secondNumInTextField! / secondDenomInTextField!
var calculatedAnswer = (secondStep + fourthStep)
var numerator = Int(calculatedAnswer * 10 * 10)
println(numerator)
answerLabel.hidden = false
answerLabel.text = printSimplifiedFraction(Numerator: numerator)
```

**printSimplifiedFraction Function**

```
func printSimplifiedFraction(Numerator numerator: Int, Denominator denominator: Int = 100) -> String
{
var finalNumerator = numerator;
var finalDenominator = denominator;
var wholeNumbers:Int = numerator / denominator;
var remainder:Int = numerator % denominator;
//println("wholeNumbers = \(wholeNumbers), remainder = \(remainder)");
//println("\(denominator) % \(remainder) = \(denominator % remainder)");
if(remainder > 0)
{
// see if we can simply the fraction part as well
if(denominator % remainder == 0) // no remainder means remainder can be simplified further
{
finalDenominator = denominator / remainder;
finalNumerator = remainder / remainder;
}
else
{
finalNumerator = remainder;
finalDenominator = denominator;
}
}
if(wholeNumbers > 0 && remainder > 0)
{
// prints out whole number and fraction parts
return("Simplified fraction of \(numerator)/\(denominator) = \(wholeNumbers) \(finalNumerator)/\(finalDenominator)");
}
else if (wholeNumbers > 0 && remainder == 0)
{
// prints out whole number only
return("Simplified fraction of \(numerator)/\(denominator) = \(wholeNumbers)");
}
else
{
// prints out fraction part only
return("Simplified fraction of \(numerator)/\(denominator) = \(finalNumerator)/\(finalDenominator)");
}
}
```

If you need any clarifications or questions please comment them down below

- Unable to create new post in Apple Developer Forum
- How to block only past dates in DatePicker in android
- How Do I Move Stuff From My Phone's Memory To An SD Card?
- iOS label's text property not updating after a Parse query?
- Sharing data/images to iOS widget/background task?
- What are the good sample projects in github which used tess-two repository?
- What could possibly be a Mysql database structure for an web app say like Flurry?
- MediaPlayer with Internal Files
- why are my tableview datasource isn't recognized in swift?
- make iWatch app without iPhone app

- Ring + Vibrate not available in 8.1?
- how to refresh layout when i press a button
- Crash & Overheating with Nokia Lumia 920
- navigation bar possibly causing UIView offset
- Crash when trying to change AVAudioFile frame position
- Is there some structured format for drawing source control branching diagrams?
- Android center textview in custom ActionBar using a linearlayout horizontally and vertically
- do i need a middleware layer to send code or what?
- ListView in Fragment vs ListFragment
- How do I transfer data from one activity to another in Android?

- Assigning responsibility for cancelling an Order
- Adding digital signature in pdf using itext jar in android
- Android Studio Web Page Notification
- Problems getting status updates from CLLocation Manager
- More than 100 app store promotion codes
- Can't use touches, accelerometer in UIWebView w/ local html
- Is there a way to have an app-icon switcher like Android 2.x in Windows 8.1?
- InApp-Purchase having two different prices
- Supersonic Origin http://localhost is therefore not allowed access
- Why is my popup view is empty?