Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Fraction {
- private int num;
- private int den;
- public int getNum() {
- return this.num;
- }
- public void setNum(int num) {
- this.num = num;
- }
- public int getDen() {
- return this.den;
- }
- public void setDen(int den) {
- this.den = den;
- }
- public Fraction(int num, int den) {
- this.setNum(num);
- this.setDen(den);
- }
- @Override
- public String toString() {
- return this.getNum() + "/" + this.getDen();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement