Skip to content

Class to represent rational numbers in Scala and perform some operations with rational numbers

License

Notifications You must be signed in to change notification settings

JoaoVitorLeite/Rational

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rational

Description

Class to represent rational numbers in Scala. A rational number is a number that can be expressed as a quotient or a fraction p/q of two integers, p being the numerator and q the denominator, where q should be different from zero. For example, the image below shows a rational number where the numerator is 2 and the denominator is 5.

About

This class was implemented using a generic type, which was implemented here, which supports some basic algebraic operations and is defined for types Int, Float, Double, Long. The tests made are of simple character, and for this the Scala Test was used. In total 33 tests were performed.

Project Structure

Rational
|
|
|
|
\--src
|   |
|   |
|   \---main
|   |   \---scala
|   |       \---rational
|   |               Num.scala
|   |               Rational.scala
|   |
|   \---test
|       \---scala
|           \---rational
|                   RationalSuite.scala
|
|
+---.gitignore
     build.sbt  
     download.png
     LICENSE
     README.md

Test

To perform the tests it is necessary to be in the root directory(where the build.sbt file is), then use the sbt test command. The tests used FunSuite and assert's.

IDE

The IDE used was Intellij Idea

References

License

The LICENSE used is Apache-2.0.

About

Class to represent rational numbers in Scala and perform some operations with rational numbers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages