Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Code requires three classes where utility, test, and fraction is required to divide fractions as well as simplify. The gcd method but needs expanding

The Code requires three classes where utility, test, and fraction is required to divide fractions as well as simplify. The gcd method but needs expanding on for infinite loops. I Also have most of the code done other than using the gcd method and need help fixing the errors as colored in red in the console. My professors instructions are at the bottom for more clarification. If u need the instructions for simplifying i can add the picture later but can't currently send it due to permission errors and will take a lil bit to get the document.

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

- eclipse-workspace - Comp 156/src/Testjava - Eclipse IDE File Edit Source Refactor Navigate Search Project Run Window Help 0 X Quick Access S o Package Explorer > Comp196 H.java Testjava Utility.java Fraction, ava 1 public class Test public static void main(Strinel] ares) { Fraction g-new Fraction(2,8); Fraction f= new Fraction("1 3/4"); System.out.println("Orie-"+f+","te); Traction()quotient_remainder-Traction.divfructif,s); System.out.println("After='+f+","+g); System.out.println("Quotient & Remainder- quotient_remainder[@]+","+ quotient_remainder[1]); 09 Console X (Fraction.java:12) at Test.main(Trst.java:4) Writable Smart Insert 13:1:408 Type here to search A D 49 0 9:15 PM 2/6/2020 - eclipse-workspace - Comp 156/src/Utility.java - Eclipse IDE File Edit Source Refactor Navigate Search Project Run Window Help 0 X Quick Access S o Package Explorer > Comp196 H.java Testjava Utility.java Fraction, ava 1 public class Utility { Comp196/src/Utility.java 2 static int find (int n, int m i while(n! -){ if(mn) else -Il-11; return my 9 } Console X (Fraction.java:12) at Test.main(Trst.java:4) Writable Smart Insert 12:1: 136 1 Type here to search AD A 9:15 PM 26/2020 - eclipse-workspace - Comp 156/src/Fractionava - Eclipse IDE File Edit Source Refactor Navigate Search Project Run Window Help 0 X Quick Access Package Explorer -O H E l Comp19 .java I Testjava Utility.java Fractionjava x public class Fraction { int nuan; int den: public Fraction(int num, int den) { this.num; this.den-den; rine fri s bered: 10 public Fraction(String frct) { String[]number-frct.split(""); int integral= Integer.parseInt(number[0]); Strinel ]nun_den-number[1].split("/"); int nun-Integer.parseInt(num_den[@]); int den=Integer.parseInt(num_den[1]); nu- integral den num; this.nu-num: this.den=den; 22 public static Traction[]divfract(Fraction f, Traction EX{ int nun divaf.nung.den; int den div-f.deng.nu; //Traction div-new Traction(num_div, den_div); f.nunenum divi f.den-den_div; int quotient-run_div/den_div; int remainder nun div % den_div; Fraction[ ]retValue- new Fraction(quotient, 1), new Fraction(remainder, 1); return retValue; 23 24 27 19 Je public String toString() { if(this.den--1) return""+this.nun also return this.num"/"-this.den; 33 Console terminated > Test Java Application Fyrrntin in the main Program Files\Javavire180_201\binjavaw.exe (Feb 6, 2020, 8:11:40 PM) line MurerfarnatyrortinnFor innut string " Writable Smart Insert 12:44:318 9:19 PM Type here to search AD 2/6/2020 * C Get Homework Help Will * Page mv. WebClass Program 1.pdf C o O cs182.ecs.csun.edu/LECTURES/Wk2/Program%201.pdf Program 1.pdf Program 1: Division in Fraction, Due on Friday Feb 7, 2020 50 points Please following the following instructions before turning in your USB 1. Your USB will have a label from outside under your_LastName_FirstName 2. Inside your USB there is a FOLDER under the name: Your_LastName_FirstName_P1. 3. Inside the above folder, a. There are only 2 or 3 files: Fraction.java and Test.java where the class Utility file can be added inside Fraction.java or to be in a separated file. There will be no files with suffix class. b. The first line in each file must bear your full name after the double slashes // 4. Your instructor will compile your files and run Test.class via cmd/terminal. Your must be responsible to make sure your files are standard to run properly. Your instructor WILL NOT touch your files. Your instructor will make his own Test file to evaluate all students' performance. 5. Here is an example of the instructions (caller) in Test.jave: Fraction = new Fraction(2,8); Fraction f new Fraction ("1 3/4"); System.out.println("Orig="+f+""+8); Fraction() quotient_remainder = Fraction divFract(f. B): System.out.println("After "+f+","+g): System.out.println("Quotient & Remainder" +quotient_remanider[0] +"," +quotient_remainder[1] ); E Type here to search 4 9:25 PM 2/6/2020 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning ASP.NET 2.0 And Databases

Authors: John Kauffman, Bradley Millington

1st Edition

0471781347, 978-0471781349

More Books

Students also viewed these Databases questions

Question

Distinguish between continental drift and plate tectonics.

Answered: 1 week ago