Code Monkey home page Code Monkey logo

starter-lab04's Introduction

STARTER-lab04 for UCSB CS56 F19

Starter code for https://ucsb-cs56.github.io/f19/lab/lab04

Commands:

To do this type this
compile regular code mvn compile
compile the test classes mvn test-compile
run tests mvn test
build executable jar mvn package
run the jar java -jar target/polynomial-1.0.jar
generate javadoc mvn javadoc:javadoc
generate javadoc for test code mvn javadoc:test-javadoc
check test coverage mvn test jacoco:report

Hints

  • Start by commenting out the toString method temporarily.

    • That will cause the class to use the ArrayList toString method instead. That way, while you work on other methods, you'll be able to see the ground truth of what's inside the Arrays.
    • Come back and uncomment it when you are ready to work on it.
  • You might want to do this so that you can focus on one method at a time:

    • cd src/test/java/edu/ucsb/cs56/polynomial
    • cp PolynomialTest.java PolynomialTest.java.keep
    • Then, delete the code inside PolynomialTest.java for all tests except the method you are working on.
    • Copy/paste the tests back into the file one at a time, and try to get one test at a time to pass.
    • Run the entire test suite each time, to make sure that when you get one test to pass, you don't break something else.
  • I suggest you focus on these methods first, since they don't depend on anything else, and they are useful when getting other things to work:

    • public static int [] lowToHigh(int [] coeffsHighToLow)
    • public static int [] highToLow(int [] coeffsLowToHigh)
    • public static int indexFirstNonZeroCoeffsLowToHigh(int [] coeffsLowToHigh)
    • public static int indexFirstNonZeroCoeffsHighToLow(int [] coeffsHighToLow)
  • Then, tackle these as a group. There is a bit of a chicken and egg problem here, because the equals method is used by JUnit, and until it is correct, the JUnit test results may be misleading! But you can't test equals unless you have a way to construct Polynomial objects. You'll have to think about how to handle that.

    • public boolean equals(Object o)
    • public Polynomial(int [] coeffsHighToLow)
    • public int getDegree()
  • Next, before tackling the plus, times, and minus, get toString working. Bugs in toString can be maddening because the JUnit output uses toString. You'll be looking at test case output, and it won't represent what's really going on. So get this working and solid before moving on.

  • Finally, I suggest doing plus, times and minus, in that order. There is a reason for doing it that way; it will save you work if you are clever.

  • When you are all done, you can submit on Gradescope. Note that there may be extra tests on Gradescope for cases that you didn't consider.

starter-lab04's People

Contributors

pconrad avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.