Skip to content

Implements fractions (or rationals) in Java. Includes arithmetic functions, toString, equals, and hashCode

License

Notifications You must be signed in to change notification settings

FHArchive/Java.Rational

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Github top language Codacy grade Codacy coverage Repository size Issues License Commit activity Last commit

Java.Rational

Project Icon

Implements fractions (or rationals) in Java. Includes arithmetic functions, toString, equals, and hashCode

Methods

- 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

Download

Clone

Using The Command Line

  1. Press the Clone or download button in the top right
  2. Copy the URL (link)
  3. Open the command line and change directory to where you wish to clone to
  4. 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

Using GitHub Desktop

  1. Press the Clone or download button in the top right
  2. Click open in desktop
  3. 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 Zip File

  1. Download this GitHub repository
  2. Extract the zip archive
  3. Copy/ move to the desired location

Language information

Built for

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/ .

Other versions

To install the latest version of eclipse go to https://www.eclipse.org/downloads/packages/installer and follow the instructions on the page.

How to run

Method 1

  1. 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
  1. Run the program with Ctrl + F11

Method 2

  1. Create a new project
  2. Copy the .java file(s) into the project
  3. Run the program with Ctrl + F11

Licence

MIT License Copyright (c) FredHappyface (See the LICENSE for more information.)

About

Implements fractions (or rationals) in Java. Includes arithmetic functions, toString, equals, and hashCode

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages