Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A method evaluate that takes a double-precision decimal number and returns a double-precision result. how do i incorporate the evaluate method into my interface, class

"A method evaluate that takes a double-precision decimal number and returns a double-precision result."
how do i incorporate the evaluate method into my interface, class and JUnit test in java? current code is attached
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
interface and JUnit attached image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
i posted new questions with clear picture and more info there
CODE SCREENSHOTS: Polyn Public Interface Polynomial As the resulting ter to the polynomial publise validadera(int coff, Intour; moet wyd eller te the polith the po public void renoveere(int power W Return the depree of the polynomial the officimtofte with the im wie it getcoefficient into); puble hoolean Sane (Polynomial) they with them Polynomial and return the ruling 1 public Polynomials Polynomial : pre rytteret structor tres artister. te wees, W Che cost restere the mot Wett Tere, tere Index is the trust private void referere, inter) What is that are Frem.size()) Winter ist theaters W Cherif tersed interes List a greater than the if(this.terepet.err.com) Serwer, else if(this.ter.getelor nr.) Accent offer to the trattare interest.coeffner.com It then the treat if (catere potter.co. else i control this thet are with Wetter alle altreler 1 This is the correct Check trate the HF er een if (this)) reference, 1). 1 r the resort west This the return the degree of the trial puble tree Weiteres ist ut (stere.stety) return this.terus.peter. throw legalStatene til de er 1 patient . Wheck Free (teresse patie treint warto if(this.com is the us . . se whes the content is the return Sant 1 ( t.co.) port oriefore portit.Text; ortation, Assert. le class follant Polynomial pli This threat Plot public void the fact polynomial). 2 Polyconal 10, mis the there the wille wil testerett 1.addre, 4) serie) 01. Tero): "..) 1.-4.0): essert, tostrine 1.Tera 2, 1). assert 1 der.: assertrouwe" ..tostrine paddera, assertas, tostring(): der 2, 2) dissert...tostring()). paddere, esserte (23224', tori padder, Els(+2.4. .toString will alwch . we 2.3 . . PALE Terawelt .., >> . will wort) 1.4 . . . . kolett Mart 1 13 TO 2) ters), . M metal wit ... ), 11 san 3.) c), 2) /** * This method tests the toString method of the Polynomial class. */ @Test public void testToString() { // Test toString assertEquals("", p1.toString()); // Add term to pl p1.addTerm(0, 7); // Test toString assertEquals("0", p1.toString()); // Add term to p1 p1.addTerm(0, 1); // Test toString assertEquals("o", p1.toString()); // Add term to p1 p1.addTerm(-11, 0); // Test toString assertEquals("-11", p1.toString(); // Add term to pl p1.addTerm(-12, 5); // Test toString assertEquals("-12x^5 - 11", p1.toString()); 0 } CODE SCREENSHOTS: I Pantalon te interface Polynomial 1 Ads the resulting in to the polyno public voidadoTerent col, int pour) public void remove Tere(int power); return the degree of the mat public intere) // Returns the coefficient of a ter with the imper public int pecoefficient inter) // Return true if this and the holy ale othew puble boolean isSame(Polynomial ) // Polynesia puble Polynomisi add(Polynomial ) public class Poloniale lenta Palma private eralisert while Polo terrayLister() wide void were coffint) 11 (10) drawer, private void weatere mere, int Check ifrater the Fors()) Altre interest the trader, ) Chere at the list faster than the // if(this.tem.petra. der.pour) dera, 3) If ther.peter.) this.tem.peter.coeffler.com # Check the If it is the theoret if (theres.pitter.com le falte this block, it that with this.terms. it is the threat if(this.tem.peter.coeff-*) thi.com.rever se control the black tattutto the industrist There er etter thia ud Trainia y and all there in the 2. at alth in / public void overaint pour rever, of the ter W Check if treater that 11 ( .site) return ase 7 check for at interest has or the the 1 (this.terus petite) renoveeri tee 1) (the terms.et).om ) leove ter att This the return them of the pill public interest Checklist ist If this termistety) return the terms.gr throw new IllegalStatet captionelynumda hal ters) rature perficiente, private int proficient inte Deck them to return Ferra. rutrum.co (.. return office. 1). Gameda while wilt FI) 7 Chat terlihat teressato all or > Private Ryan after the returer af (staro). - -- (Fiaislai . return false; . Phot . . C. 1.com Sri Stringuter softer. fer- 1 endir s.). ters. ter ......) laster ce vor who > walt Teranto ELS > se string turint) 1 (this.co reture ser rest Es scoff as if rele collant in the Cut) the coefficient, return the else if(this.colf - 1) . if(this.colo) return(this.coeff 1) ..por als portunit. Before portorit. Test: import statie ore junit.Assert." puble class Rolynomialit Pollobjecte Polynomial Polynomial Importunit.Before import organit. Test: port statie are unit.Assert. public class Polycelaluit W Polylact Polynomialli Folynomial public void throception plne Polynomial). 2 Polypo. West wolle veld testere addr3, 4); asser, 1.tostring); plader. asser, 1.test) para 4, 0) assert, pl.toString() paddere. 1). asserts" - , .totring()); 1.ader(-5, 3); assertuels.5.x - 4. p.toString()) padder) assertEquals("*, 2.tostring) p2.oder 2.2) asserts(224", .tostring) addera(2): assertEquals("x...tore): 2 aderat, 7); assertiques...", tostring) " The wted test the moverethod of the Police eest publie vedd testRenoveer) 1 Add to 2.4.): 2. der 2, 2): 2.odern(2.): derecte, remera(7), assertEquals("x4" ..tostring(); metere with our 10 fra? remover(10) seul", .toString()); Test pilie veld testGetDegree) 1 Alderto per..) 2ddere, 2); 2.defert.), 12.10.13 assertEquals(7. 2.getDegree(): removeera (7) asserts). p.prtDegree()); assertEquals(3. 2.petDegree(): test publle vole testetCoefficient // Add tertut pladdera(3, 4). padderale, 7); pladder(-4). padderal. 1) adders, essertEquals, leolicien(123) assertEquals(), l. Coefficient (4) assertEquals(-4, el.ptCoefficient() . This method tests the time wethod of the Polynomial de rest public void testame) { 1 Add terete pladern(3, 4); padderet, 1); pladder-.): pladder(2, 1); 1/Add to paddera(-4): 2.adder), 4); 2.ader(-5, ): padder(2, 1); assertru(pl.isSame(o)) asserte. Isso (1) od tereta padder11, ); Test athed for assertfatset. issone (2) assertralsep.pl) This method tests the that the Parental cler test public void tester) W/ Adoro 03. addere , e). 22.addere..) Test as the assertiola. Col.().toString(): Arte pladere), 4), padder. odern2, 1); ladderal, 1 Attert 2.adderet) odaderat. test and the The method tests the toering method of the Political pilte vou testostrinet) Testing asserts..tostrine 1 Mesto 3.deret, 7); Test Strine addr2, 2) 2 aderat, // Tetthed assertiquals("**.22.1", (pl.add(pa).tostrine) This thesis the time to the Royal est publie veld testostring) Test to esserquals("w", tostad) 1 Adet pledderet, assertiques, tostring); Aadare te pladder, 1); 1 Test osserolstostrine) /Ad tereto ladder-11.). Il testosti assertEquals(-11. pl.tostring). W dret aldera-13, 5): essertEquals(th511", tostring) JUNIT RUN OUTPUT: Runty a fore 0 polynomial Polynomialement 40.000 BestAdd Term 00000 testAdd00000 i tester Coefficient 10.000 toString 10.000 test Remove ferm 0000 desetDegree 0.000 UML: // Polynomial.java public interface Polynomial { // Adds the resulting term to the polynomial public void addTerm(int coeff, int power); // Removes any and all terms in the polynomial with the given power public void removeTerm(int power); // Returns the degree of the polynomial public int getDegree(); // Returns the coefficient of a term with the given power public int getCoefficient(int power); // Returns true if this and the given polynomial are same, false otherwise public boolean isSame (Polynomial p); // Adds this Polynomial with the given Polynomial and returns the resulting // Polynomial public Polynomial add(Polynomial p); } // End of class Term import org. junit.Before; import org.junit. Test; import static org.junt.Assert."; public class PolynomialJUnit { // Polynomial objects Polynomial pl; Polynomial p2; This method creates Polynonial objects pl and p2. Before public void setup() throws Exception pl = new PolynomialImpl(); p2 = new Polynomialimpl(); ) / This method tests the addTerm method of the Polynomial "/ Test public void testAddTerm() { Add terms to pi pl.addTerm(3, 4); assertEquals("3x^4", pi.toString()); p1.addTerm(e, 7); assertEquals("3x^4", pi.toString()); p1.addTerm(-4, 0); assertEquals("3x^4 - 4", pl.toString(); pl.addTerm(2, 1); assertEquals("3x^4 + 2x^1 - 4", pl.toString(); pl.addTerm(-5, 3); assertEquals("3x^4 - 5x^3 + 2x^1 - 4", pl.toString()); Add terms to p2 p2.addTerm(4, 0); assertEquals("4", p2.toString()); p2.addTerm(2, 2); assertEquals("2x^24", p2.toString(); p2.addTern(2, 3); assertEquals("2x^3 + 2x^2 + 4", p2.toString(); p2.addTerm(10, 7); assertEquals("18x^2 + 2x^3 + 2x^2 + 4", p2.toString) ) This method tests the removeTern method of the Polynom / Test public void testRemove Tern() { // Add terms to p2 p2.addTerm( . This method tests the remove Term method of the Polynom */ @Test public void testRemove Term() { // Add terms to p2 p2.addTerm(4, 0); p2.addTerm(2, 2), P2.addTerm(2, 3); p2.addTerm(10, 7); // Renove ter with power 7 from p2 p2.remove Term(); assertEquals("2x^3 + 2x^2 + 4", p2.toString()); // Remove ters with power 10 from p2 P2.removeTerm(10); assertEquals("2x^3 2x^2 + 4", p2.toString()); } * This method tests the getDegree method of the Polynomi */ Test public void testGetDegree() { // Add terms to p2 p2.addTerm(4, 0); p2.addTerm(2, 2); P2.addTerm(2, 3); p2.addTerm(10, 7); // Test getDegree assertEquals(7, p2.getDegree()); // Remove ter with power 7 from p2 p2.remove Term(7); assertEquals(3, p2.getDegree()); ) * This method tests the getCoefficient method of the Pol */ Test public void testGetCoefficient() { // Add terms to pl pi.addTerm(3, 4); pi.addTerm(e, 7); pl.addTerm(-4, 0); pl.addTerm(2, 1); p1.addTerm(-5, 3); // Test get coefficient assertEquals(0, pl.getCoefficient (12)) assertEquals(3, pl.getCoefficient (4)); assertEquals(-4, pi.getCoefficient(e)); } This method tests the isSane method of the Polynomial This method tests the issame method of the Poly..tial @Test public void testIssame() { // Add terms to pi pi.addTerm(3, 4); pl.addTerm(0,7); p1.addTerm(-4, 0); pi.addTern(2, 1); pi.addTerm(-5, 3); // Add teres to p2 p2.addTerm(-4, 0); P2.addTerm(3, 4); p2.addTerm(-5, 3); p2.addTerm(2, 1); // Test isSame method for pl and p2 assert True (pl.isSame(p2)); assert True(p2. isSame(p1)); // Add terms to pa p2.addTerm(11, 7); // Test isSame method for pi and p2 assertFalse(p1.isSame (p2)); assertFalse(p2. isSame(p1)); > This method tests the add method of the Polynomial class */ @Test public void testAdd() // Add terms to pl pl.addTerm(-4, 0); // Add terms to p2 p2.addTerm(4, 0); // Test add method assertEquals("a", (p1.add(p2)).toString()); // Add terms to pt pi.addTern(3, 4); pl. addTerm(e, 7); p1.addTerm(2, 1); pi.addTerm(-5, 3); // Add terms to p2 p2.addTerm(2, 2); P2.addTerm(2, 3); // Test add method assertEquals("3x^4 - 3x^3 + 2x^2 + 2x*1", (p1.add(p2)) } Thi of the Polynomial } This method tests the toString method of the Polynor "/ Test public void testToString() { // Test toString assertEquals("a", pi.toString(); // Add term to p1 pl.addTerm(@, 7); // Test toString assertEquals("w", pi.toString(); // Add term to pi p1.addTerm(0, 1); // Test toString assertEquals("@", pl.toString(); // Add term to pl pl.addTerm(-11, 0); // Test toString assertEquals("-11", p1.toString()); // Add term to pl p1.addTerm(-12, 5); // Test toString assertEquals("-12x^5 - 11", pl.toString()); 3 JUNIT RUN OUTPUT: Runs: 717 Errors: 0 polynomial4.PolynomialJUnit (Runner. JUnit 4) (0.000 s) testAdd Term (0.0005) testAdd(0.0005) testGetCoefficient (0.0005) s testToString (0.000 citestRemove Term (0.0005) testGetDegree (0.000 s) testisSame (0.0005) HMI CODE SCREENSHOTS: Polyn Public Interface Polynomial As the resulting ter to the polynomial publise validadera(int coff, Intour; moet wyd eller te the polith the po public void renoveere(int power W Return the depree of the polynomial the officimtofte with the im wie it getcoefficient into); puble hoolean Sane (Polynomial) they with them Polynomial and return the ruling 1 public Polynomials Polynomial : pre rytteret structor tres artister. te wees, W Che cost restere the mot Wett Tere, tere Index is the trust private void referere, inter) What is that are Frem.size()) Winter ist theaters W Cherif tersed interes List a greater than the if(this.terepet.err.com) Serwer, else if(this.ter.getelor nr.) Accent offer to the trattare interest.coeffner.com It then the treat if (catere potter.co. else i control this thet are with Wetter alle altreler 1 This is the correct Check trate the HF er een if (this)) reference, 1). 1 r the resort west This the return the degree of the trial puble tree Weiteres ist ut (stere.stety) return this.terus.peter. throw legalStatene til de er 1 patient . Wheck Free (teresse patie treint warto if(this.com is the us . . se whes the content is the return Sant 1 ( t.co.) port oriefore portit.Text; ortation, Assert. le class follant Polynomial pli This threat Plot public void the fact polynomial). 2 Polyconal 10, mis the there the wille wil testerett 1.addre, 4) serie) 01. Tero): "..) 1.-4.0): essert, tostrine 1.Tera 2, 1). assert 1 der.: assertrouwe" ..tostrine paddera, assertas, tostring(): der 2, 2) dissert...tostring()). paddere, esserte (23224', tori padder, Els(+2.4. .toString will alwch . we 2.3 . . PALE Terawelt .., >> . will wort) 1.4 . . . . kolett Mart 1 13 TO 2) ters), . M metal wit ... ), 11 san 3.) c), 2) /** * This method tests the toString method of the Polynomial class. */ @Test public void testToString() { // Test toString assertEquals("", p1.toString()); // Add term to pl p1.addTerm(0, 7); // Test toString assertEquals("0", p1.toString()); // Add term to p1 p1.addTerm(0, 1); // Test toString assertEquals("o", p1.toString()); // Add term to p1 p1.addTerm(-11, 0); // Test toString assertEquals("-11", p1.toString(); // Add term to pl p1.addTerm(-12, 5); // Test toString assertEquals("-12x^5 - 11", p1.toString()); 0 } CODE SCREENSHOTS: I Pantalon te interface Polynomial 1 Ads the resulting in to the polyno public voidadoTerent col, int pour) public void remove Tere(int power); return the degree of the mat public intere) // Returns the coefficient of a ter with the imper public int pecoefficient inter) // Return true if this and the holy ale othew puble boolean isSame(Polynomial ) // Polynesia puble Polynomisi add(Polynomial ) public class Poloniale lenta Palma private eralisert while Polo terrayLister() wide void were coffint) 11 (10) drawer, private void weatere mere, int Check ifrater the Fors()) Altre interest the trader, ) Chere at the list faster than the // if(this.tem.petra. der.pour) dera, 3) If ther.peter.) this.tem.peter.coeffler.com # Check the If it is the theoret if (theres.pitter.com le falte this block, it that with this.terms. it is the threat if(this.tem.peter.coeff-*) thi.com.rever se control the black tattutto the industrist There er etter thia ud Trainia y and all there in the 2. at alth in / public void overaint pour rever, of the ter W Check if treater that 11 ( .site) return ase 7 check for at interest has or the the 1 (this.terus petite) renoveeri tee 1) (the terms.et).om ) leove ter att This the return them of the pill public interest Checklist ist If this termistety) return the terms.gr throw new IllegalStatet captionelynumda hal ters) rature perficiente, private int proficient inte Deck them to return Ferra. rutrum.co (.. return office. 1). Gameda while wilt FI) 7 Chat terlihat teressato all or > Private Ryan after the returer af (staro). - -- (Fiaislai . return false; . Phot . . C. 1.com Sri Stringuter softer. fer- 1 endir s.). ters. ter ......) laster ce vor who > walt Teranto ELS > se string turint) 1 (this.co reture ser rest Es scoff as if rele collant in the Cut) the coefficient, return the else if(this.colf - 1) . if(this.colo) return(this.coeff 1) ..por als portunit. Before portorit. Test: import statie ore junit.Assert." puble class Rolynomialit Pollobjecte Polynomial Polynomial Importunit.Before import organit. Test: port statie are unit.Assert. public class Polycelaluit W Polylact Polynomialli Folynomial public void throception plne Polynomial). 2 Polypo. West wolle veld testere addr3, 4); asser, 1.tostring); plader. asser, 1.test) para 4, 0) assert, pl.toString() paddere. 1). asserts" - , .totring()); 1.ader(-5, 3); assertuels.5.x - 4. p.toString()) padder) assertEquals("*, 2.tostring) p2.oder 2.2) asserts(224", .tostring) addera(2): assertEquals("x...tore): 2 aderat, 7); assertiques...", tostring) " The wted test the moverethod of the Police eest publie vedd testRenoveer) 1 Add to 2.4.): 2. der 2, 2): 2.odern(2.): derecte, remera(7), assertEquals("x4" ..tostring(); metere with our 10 fra? remover(10) seul", .toString()); Test pilie veld testGetDegree) 1 Alderto per..) 2ddere, 2); 2.defert.), 12.10.13 assertEquals(7. 2.getDegree(): removeera (7) asserts). p.prtDegree()); assertEquals(3. 2.petDegree(): test publle vole testetCoefficient // Add tertut pladdera(3, 4). padderale, 7); pladder(-4). padderal. 1) adders, essertEquals, leolicien(123) assertEquals(), l. Coefficient (4) assertEquals(-4, el.ptCoefficient() . This method tests the time wethod of the Polynomial de rest public void testame) { 1 Add terete pladern(3, 4); padderet, 1); pladder-.): pladder(2, 1); 1/Add to paddera(-4): 2.adder), 4); 2.ader(-5, ): padder(2, 1); assertru(pl.isSame(o)) asserte. Isso (1) od tereta padder11, ); Test athed for assertfatset. issone (2) assertralsep.pl) This method tests the that the Parental cler test public void tester) W/ Adoro 03. addere , e). 22.addere..) Test as the assertiola. Col.().toString(): Arte pladere), 4), padder. odern2, 1); ladderal, 1 Attert 2.adderet) odaderat. test and the The method tests the toering method of the Political pilte vou testostrinet) Testing asserts..tostrine 1 Mesto 3.deret, 7); Test Strine addr2, 2) 2 aderat, // Tetthed assertiquals("**.22.1", (pl.add(pa).tostrine) This thesis the time to the Royal est publie veld testostring) Test to esserquals("w", tostad) 1 Adet pledderet, assertiques, tostring); Aadare te pladder, 1); 1 Test osserolstostrine) /Ad tereto ladder-11.). Il testosti assertEquals(-11. pl.tostring). W dret aldera-13, 5): essertEquals(th511", tostring) JUNIT RUN OUTPUT: Runty a fore 0 polynomial Polynomialement 40.000 BestAdd Term 00000 testAdd00000 i tester Coefficient 10.000 toString 10.000 test Remove ferm 0000 desetDegree 0.000 UML: // Polynomial.java public interface Polynomial { // Adds the resulting term to the polynomial public void addTerm(int coeff, int power); // Removes any and all terms in the polynomial with the given power public void removeTerm(int power); // Returns the degree of the polynomial public int getDegree(); // Returns the coefficient of a term with the given power public int getCoefficient(int power); // Returns true if this and the given polynomial are same, false otherwise public boolean isSame (Polynomial p); // Adds this Polynomial with the given Polynomial and returns the resulting // Polynomial public Polynomial add(Polynomial p); } // End of class Term import org. junit.Before; import org.junit. Test; import static org.junt.Assert."; public class PolynomialJUnit { // Polynomial objects Polynomial pl; Polynomial p2; This method creates Polynonial objects pl and p2. Before public void setup() throws Exception pl = new PolynomialImpl(); p2 = new Polynomialimpl(); ) / This method tests the addTerm method of the Polynomial "/ Test public void testAddTerm() { Add terms to pi pl.addTerm(3, 4); assertEquals("3x^4", pi.toString()); p1.addTerm(e, 7); assertEquals("3x^4", pi.toString()); p1.addTerm(-4, 0); assertEquals("3x^4 - 4", pl.toString(); pl.addTerm(2, 1); assertEquals("3x^4 + 2x^1 - 4", pl.toString(); pl.addTerm(-5, 3); assertEquals("3x^4 - 5x^3 + 2x^1 - 4", pl.toString()); Add terms to p2 p2.addTerm(4, 0); assertEquals("4", p2.toString()); p2.addTerm(2, 2); assertEquals("2x^24", p2.toString(); p2.addTern(2, 3); assertEquals("2x^3 + 2x^2 + 4", p2.toString(); p2.addTerm(10, 7); assertEquals("18x^2 + 2x^3 + 2x^2 + 4", p2.toString) ) This method tests the removeTern method of the Polynom / Test public void testRemove Tern() { // Add terms to p2 p2.addTerm( . This method tests the remove Term method of the Polynom */ @Test public void testRemove Term() { // Add terms to p2 p2.addTerm(4, 0); p2.addTerm(2, 2), P2.addTerm(2, 3); p2.addTerm(10, 7); // Renove ter with power 7 from p2 p2.remove Term(); assertEquals("2x^3 + 2x^2 + 4", p2.toString()); // Remove ters with power 10 from p2 P2.removeTerm(10); assertEquals("2x^3 2x^2 + 4", p2.toString()); } * This method tests the getDegree method of the Polynomi */ Test public void testGetDegree() { // Add terms to p2 p2.addTerm(4, 0); p2.addTerm(2, 2); P2.addTerm(2, 3); p2.addTerm(10, 7); // Test getDegree assertEquals(7, p2.getDegree()); // Remove ter with power 7 from p2 p2.remove Term(7); assertEquals(3, p2.getDegree()); ) * This method tests the getCoefficient method of the Pol */ Test public void testGetCoefficient() { // Add terms to pl pi.addTerm(3, 4); pi.addTerm(e, 7); pl.addTerm(-4, 0); pl.addTerm(2, 1); p1.addTerm(-5, 3); // Test get coefficient assertEquals(0, pl.getCoefficient (12)) assertEquals(3, pl.getCoefficient (4)); assertEquals(-4, pi.getCoefficient(e)); } This method tests the isSane method of the Polynomial This method tests the issame method of the Poly..tial @Test public void testIssame() { // Add terms to pi pi.addTerm(3, 4); pl.addTerm(0,7); p1.addTerm(-4, 0); pi.addTern(2, 1); pi.addTerm(-5, 3); // Add teres to p2 p2.addTerm(-4, 0); P2.addTerm(3, 4); p2.addTerm(-5, 3); p2.addTerm(2, 1); // Test isSame method for pl and p2 assert True (pl.isSame(p2)); assert True(p2. isSame(p1)); // Add terms to pa p2.addTerm(11, 7); // Test isSame method for pi and p2 assertFalse(p1.isSame (p2)); assertFalse(p2. isSame(p1)); > This method tests the add method of the Polynomial class */ @Test public void testAdd() // Add terms to pl pl.addTerm(-4, 0); // Add terms to p2 p2.addTerm(4, 0); // Test add method assertEquals("a", (p1.add(p2)).toString()); // Add terms to pt pi.addTern(3, 4); pl. addTerm(e, 7); p1.addTerm(2, 1); pi.addTerm(-5, 3); // Add terms to p2 p2.addTerm(2, 2); P2.addTerm(2, 3); // Test add method assertEquals("3x^4 - 3x^3 + 2x^2 + 2x*1", (p1.add(p2)) } Thi of the Polynomial } This method tests the toString method of the Polynor "/ Test public void testToString() { // Test toString assertEquals("a", pi.toString(); // Add term to p1 pl.addTerm(@, 7); // Test toString assertEquals("w", pi.toString(); // Add term to pi p1.addTerm(0, 1); // Test toString assertEquals("@", pl.toString(); // Add term to pl pl.addTerm(-11, 0); // Test toString assertEquals("-11", p1.toString()); // Add term to pl p1.addTerm(-12, 5); // Test toString assertEquals("-12x^5 - 11", pl.toString()); 3 JUNIT RUN OUTPUT: Runs: 717 Errors: 0 polynomial4.PolynomialJUnit (Runner. JUnit 4) (0.000 s) testAdd Term (0.0005) testAdd(0.0005) testGetCoefficient (0.0005) s testToString (0.000 citestRemove Term (0.0005) testGetDegree (0.000 s) testisSame (0.0005) HMI

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_2

Step: 3

blur-text-image_3

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

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

More Books

Students also viewed these Databases questions