/** This is the delete method which is used to remove a term from polynomial */ public void delete(int c, int e) { Term t = new Term(c, e); for (int i = 0; i < poly.size(); i++) { if (t.getCoe() == poly.get(i).getCoe() && t.getExp() == poly.get(i).getExp()) { poly.remove(i); break; } else { if (i == poly.size() - 1) { System.out.println("This term is not in the polynomial."); } } } }