subject

Does somebody know how to this. This is what I got so far import java. io.*;
import java. util. Scanner;

public class Lab33bst
{

public static void main (String args[]) throws IOException
{

Scanner input = new Scanner(System. in);

System. out. print("Enter the degree of the polynomial --> ");
int degree = input. nextInt();
System. out. println();

PolyNode p = null;
PolyNode temp = null;
PolyNode front = null;

System. out. print("Enter the coefficent x^" + degree + " if no term exist, enter 0 --> ");
int coefficent = input. nextInt();
front = new PolyNode(coefficent, degree, null);
temp = front;
int tempDegree = degree;
//System. out. println(front. getCoeff() + " " + front. getDegree());
for (int k = 1; k <= degree; k++)
{
tempDegree--;
System. out. print("Enter the coefficent x^" + tempDegree + " if no term exist, enter 0 --> ");
coefficent = input. nextInt();
p = new PolyNode(coefficent, tempDegree, null);
temp. setNext(p);
temp = p;
}
System. out. println();

p = front;
while (p != null)
{

System. out. println(p. getCoeff() + "^" + p. getDegree() + "+" );
p = p. getNext();

}
System. out. println();
}

}

class PolyNode
{

private int coeff; // coefficient of each term
private int degree; // degree of each term
private PolyNode next; // link to the next term node

public PolyNode (int c, int d, PolyNode initNext)
{
coeff = c;
degree = d;
next = initNext;
}

public int getCoeff()
{
return coeff;
}

public int getDegree()
{
return degree;
}

public PolyNode getNext()
{
return next;
}

public void setCoeff (int newCoeff)
{
coeff = newCoeff;
}

public void setDegree (int newDegree)
{
degree = newDegree;
}

public void setNext (PolyNode newNext)
{
next = newNext;
}

}

This is the instructions for the lab. Somebody please help. I need to complete this or I'm going fail the class please help me.
Write a program that will evaluate polynomial functions of the following type:

Y = a1Xn + a2Xn-1 + a3Xn-2 + . . . an-1X2 + anX1 + a0X0 where X, the coefficients ai, and n are to be given.

This program has to be written, such that each term of the polynomial is stored in a linked list node.
You are expected to create nodes for each polynomial term and store the term information. These nodes need to be linked to each previously created node. The result is that the linked list will access in a LIFO sequence. When you display the polynomial, it will be displayed in reverse order from the keyboard entry sequence.

Make the display follow mathematical conventions and do not display terms with zero coefficients, nor powers of 1 or 0. For example the polynomial Y = 1X^0 + 0X^1 + 0X^2 + 1X^3 is not concerned with normal mathematical appearance, don’t display it like that. It is shown again as it should appear. Y = 1 + X^3

Normal polynomials should work with real number coefficients. For the sake of this program, assume that you are strictly dealing with integers and that the result of the polynomial is an integer as well. You will be provided with a special PolyNode class. The PolyNode class is very similar to the ListNode class that you learned about in chapter 33 and in class. The ListNode class is more general and works with object data members. Such a class is very practical for many different situations. For this assignment, early in your linked list learning, a class has been created strictly for working with a linked list that will store the coefficient and the degree of each term in the polynomial.

class PolyNode
{
private int coeff; // coefficient of each term
private int degree; // degree of each term
private PolyNode next; // link to the next term node

public PolyNode (int c, int d, PolyNode initNext)
{
coeff = c;
degree = d;
next = initNext;
}

public int getCoeff()
{
return coeff;
}

public int getDegree()
{
return degree;
}

public PolyNode getNext()
{
return next;
}

public void setCoeff (int newCoeff)
{
coeff = newCoeff;
}

public void setDegree (int newDegree)
{
degree = newDegree;
}

public void setNext (PolyNode newNext)
{
next = newNext;
}
}

You are expected to add various methods that are not provided in the student version. The sample execution will indicate which methods you need to write. Everything could be finished in the main method of the program, but hopefully you realize by now that such an approach is rather poor program design.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 02:00
What is the process in which the software development team compiles information to determine the final product.
Answers: 3
question
Computers and Technology, 22.06.2019 03:40
Hello my name is mihai and i need your : )i have to do a python project in computer science and i’m really busy with my mocks this period of time besides this i’m not good at coding so could someone pls pls pls sort me out ? i actually beg ; ))
Answers: 1
question
Computers and Technology, 22.06.2019 06:30
This technology is used to produce high-quality documents that look good on the computer screen and in print. wiki presentation paint desktop publishing
Answers: 3
question
Computers and Technology, 22.06.2019 18:30
All of the following are characteristics that must be contained in any knowledge representation scheme except
Answers: 3
You know the right answer?
Does somebody know how to this. This is what I got so far import java. io.*;
import java. uti...
Questions
question
Arts, 23.09.2019 19:30
question
English, 23.09.2019 19:30
question
Social Studies, 23.09.2019 19:30