Implements fractions (or rationals) in Java. Includes arithmetic functions, toString, equals, and hashCode
- setNum(int num) > void: [none]
- getNum() > int: num
- setDenom(int denom) > void: [none]
- getDenom() > int: denom
- add(Rational rhs) > Rational: result
- subtract(Rational rhs) > Rational: result
- multiply(Rational rhs) > Rational: result
- divide(Rational rhs) > Rational: result
- toString() > String: toString
- compareTo(Rational rhs) > bool: compare
- gcd(int num, int denom) > int: greatestCommonDemominator
- simplify() > void: [none]
- equals(Object rhs) > bool: isEqual
- hashCode() > int: hash
- Press the Clone or download button in the top right
- Copy the URL (link)
- Open the command line and change directory to where you wish to clone to
- Type 'git clone' followed by URL in step 2
$ git clone https://github.com/[user-name]/[repository]
More information can be found at https://help.github.com/en/articles/cloning-a-repository
- Press the Clone or download button in the top right
- Click open in desktop
- Choose the path for where you want and click Clone
More information can be found at https://help.github.com/en/desktop/contributing-to-projects/cloning-a-repository-from-github-to-github-desktop
- Download this GitHub repository
- Extract the zip archive
- Copy/ move to the desired location
This program has been written in Java using Eclipse Neon Release (4.6.0) on Windows 10 http://archive.eclipse.org/eclipse/downloads/drops4/R-4.6-201606061100/ .
To install the latest version of eclipse go to https://www.eclipse.org/downloads/packages/installer and follow the instructions on the page.
- Import the project directory (containing the bin and src directories)
- Click File> Import
- Select Projects from Folder or Archive, click next
- Select Directory and navigate to the project directory (select ok)
- Ensure Search for nested projects is ticked
- Click Finish
- Run the program with Ctrl + F11
- Create a new project
- Copy the .java file(s) into the project
- Run the program with Ctrl + F11
MIT License Copyright (c) FredHappyface (See the LICENSE for more information.)