// Task 1
public class Term : IComparable
{
private double Coefficient;
private byte Exponent;
// Creates a term with the given coefficient and exponent
public Term(double coefficient, byte exponent)
{
Coefficient = coefficient;
Exponent = exponent;
}
// Evaluates the current term for a given x
public double Evaluate(double x)
{
return Coefficient * [login to view URL](x, Exponent);
}
// Returns -1, 0, or 1 if the exponent of the current term
// is less than, equal to, or greater than the exponent of obj.
public int CompareTo(Object obj)
{
Term other = (Term)obj;
if (Exponent < [login to view URL])
{
return -1;
}
else if (Exponent == [login to view URL])
{
return 0;
}
else
{
return 1;
}
}
// Read and write properties for each data member
}
// Task 2
public class Node<T>
{
private T item;
private Node<T> next;
// constructor
public Node(T item, Node<T> next)
{
[login to view URL] = item;
[login to view URL] = next;
}
// Read and write properties or getter/setter for each data member
public T getItem()
{
return item;
}
public void setItem(T item)
{
[login to view URL] = item;
}
public Node<T> getNext()
{
return next;
}
public void setNext(Node<T> next)
{
[login to view URL] = next;
}
}
// Task 3
interface IDegree
{
bool Order(Object obj);
}
public class Polynomial : IDegree
{
// A reference to the first node of a singly-linked list
private Node<Term> front;
// Inserts the given term t into the current polynomial in its proper order
public void AddTerm(Term t) {
if (t != null) ;
[login to view URL](sum("OLD, polynomial consisting of term t"))
}
{ … }
// Adds the given polynomials p and q to yield a new polynomial
public static Polynomial operator +(Polynomial p, Polynomial q)
{ … }
// Multiplies the given polynomials p and q to yield a new polynomial
public static Polynomial operator *(Polynomial p, Polynomial q)
{ … }
// Evaluates the current polynomial for a given x
public double Evaluate(double x)
{ … }
// Prints the current polynomial
public void Print()
{ … }
public bool Order(Object obj)
{ … }
}
Hi.
I have read your description and have interests in your project.
I would like to have a discussion with chat to get more about your project.
Thanks.
Hi there, I do Java programming. I checked your initial code and I would like to do this project if given the opportunity. Let me know if you are interested so I can have further details.