This repository is part of a series of Java tutorials for a Rational class written by Phill Conrad for CMPSC 56, a Java course taught in the Dept. of Computer Science at UC Santa Barbara.
- https://ucsb-cs56-pconrad.github.io/tutorials/rational/
- https://ucsb-cs56-pconrad.github.io/tutorials/rational_ex01/
Previous Repo | This Repo | Next Repo |
---|---|---|
cs56-rational-ex01 | cs56-rational-ex02 |
Once you clone this repo, these commands show how to compile and run the code inside.
-bash-4.3$ ls
Main.java Rational.java README.md
-bash-4.3$ javac Main.java
-bash-4.3$ ls
Main.class Main.java Rational.class Rational.java README.md
-bash-4.3$ javac Rational.java
-bash-4.3$ ls
Main.class Main.java Rational.class Rational.java README.md
-bash-4.3$ java Main
Usage: java Main int denom
int and denom should be integers; denom may not be zero.
-bash-4.3$ java Main 3 4
r1 = Rational@2a139a55
r2 = Rational@15db9742
-bash-4.3$