Question: For a java assignment, I am tasked to write a program that consists of two classes. The first class is called Polynomial() and it represents

For a java assignment, I am tasked to write a program that consists of two classes. The first class is called Polynomial() and it represents a polynomial object that consists of an array that stores all of the coefficients for that polynomial. The second class is called PolynomialUI() and it represents the command line user interface for the polynomial object. It gets input and displays output for the user. The part that I am stuck on is this. In the description of PolynomialUI() it states that the constructor, public PolynomialUI(), will create and intitialize the polynomial object and all other program state. I am not allowed to have this class extend Polynomial. I am struggling because when i instantiate the object in the constructor, and then instantiate PolynomialUI object in the main method of PolynomialUI(), i am unable to access the Polynomial object and the corresponding methods from Polynomial in the methods of PolynomialUI(). For instance, one method takes in user input and fills the Polynomial array. This is done by calling on the addCoefficient() method contained in Polynomial class. I am unable to do this and it continues to give me errors. Help would be very much appreciated because I cannot figure out how to do what is being asked.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!