Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago