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

- Play store licensing outside of version control
- Change colour indicator in SlidingTabLayout
- Plist File cannot be created. iOS+NSDictionary+JSON
- Questions about getting MCTS
- iOS CoreBluetooth: State Preservation and Restoration
- IOS spriteKit : collisions and contactTestBitMask not working
- Restkit returning nil response from Foursquare API
- How to make a mobile operating system., for example ios, Android, or for wearable computers? [on hold]
- I'm looking to program this software. Any thoughts?
- How to Import Webview data into the listview

- Android XML table layout for small and xlarge screens
- TextView size depending on TextView width
- Error in Android Encrypted Sqlite database net.sqlcipher.database.SQLiteException: file is encrypted or is not a database
- Drawback of using static method
- how to make MPMoviePlayerController continue to play when i display a modal view
- In need of a link to open an iOS app if installed or else go to the iTunes store
- Inventory not populated with in app purchases?
- How to populate an ArrayAdapter via a class?
- IE doesn't show the full picture
- Minimum Google Play Services version for Push Notification

- git for (MATLAB) lib in use -- developing at the same time
- Rarely used unicode character I can pinch for myself? [on hold]
- Trouble ranging beacons on iOS 8
- play audio stream in a separate thread with OpenAL on IOS
- How can I control two fragments with one button?
- Xcode Check If Point Is in Transformed UIView
- How would I go about tracking the amount of time elapsed since the application was ran in xcode?
- Is it possible to test my iPhone application on iOS 7.1.2 and Xcode version is 6.1.1 without developer program
- Level Selection Screen Android
- Duplicate Parse.com User objectId to another column