Highest Number Pairing Problem
This program solves a simple math problem...
Find two numbers that add up to the given number (by default is 8), such that the product multiplied by the difference produces the largest possible value.
From the command line, enter to build:
$ swift build
From the command line, enter to run:
$ swift run
$ swift run HighestNumberPairing
You will get a prompt that allows you to enter the number to use. The default is 8, if nothing is entered.
Optionally, you can add the number as a second argument:
$ swift run HighestNumberPairing 16
This runs the program with 16 as the number to use.
By default, the program displays up to 10 other top results (sorted high to low). You can pass
false as an optional second parameter in the command line to opt out of collecting other results.
$ swift run HighestNumberPairing 8 no
$ swift run HighestNumberPairing 8 false
From the command line, enter to run all unit tests:
$ swift test
Tests can also be run from within Xcode.
- New recursive method to find more accurate answer
- New ability to take user input from command line or input prompt
- Collecting and displaying other results is now optional
- Added unit tests
- Revised module structure for better command line testability
- More unit testing.
- Improve number formatting for printout (low priority)