Question: Here is the starter file: Help with java fraction code! Here us the tester file: Thanks!! Fraction.java A class (data type) definition file This file

Here is the starter file:

Here is the starter file: Help with java fraction code! Here us

Help with java fraction code!

the tester file: Thanks!! Fraction.java A class (data type) definition file This

Here us the tester file:

file just defines what a Fraction is This file is NOT a

Thanks!!

Fraction.java A class (data type) definition file This file just defines what a Fraction is This file is NOT a program data members are PRIVATE *method nembers are PUBLIC public class Fraction private int numer private int denom ACCESSORS public int getNumer ) return numer public int getDenom() return denom; public String tostring) return numer + .1" + denom; // TATORS public void setNumer int n numern public void setDenom( int d) if (di-0) else I/ error msg OR exception OR exit ete /I DEFAULT CONSTRUCTOR no args passed in public Fraction( this( 0, 1 "this" means call a fellow constructor // 1 arg CONSTRUCTOR 1 arg passed in /I assume user wants whole number public Fraction int n this( n, 1 / "this" means call a fellow constructor FULL CONSTRUCTOR-an arg for each class data menber public Fraction( int n, int d) II you could cale the ged(n.d) here and then divide both by ged in the setter calls setNumer (n) I .e. setNumert n/ged setDenom(d)i I/ same here II COPY CONSTRUCTOR takes ref to some already initialized Fraction object public Fraction( Fraction other) this other.numer, other.denom) call y full C Tor with other Fraction's data private void reduce () /I reduces this fraction to lovest form EOF

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!