ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 29 May 2017 My Price 11.00

CSc 127B — Introduction to Computer Science IIFall 2015

Hey Everyone! This is a Java Program which I am supposed to complete in like 1 day.

My professor has shifted the due date back by 1 day or so.

The programing language is java and the Program used as the platform is DrJava.

 

CSc 127B — Introduction to Computer Science IIFall 2015 (McCann)http://www.cs.arizona.edu/classes/cs127b/fall15/Program #4: PolynomialsDue Date: October 1st, 2015, at 9:00 p.m. MSTOverview:In class, we have been talking about class reuse in general and interfaces in particular, and areabout to start talking about list data structures and their representation. Given what you know of Java at themoment, the only representation we can use to hold the members of a list is an array.You should already be quite familiar with polynomials, thanks to years of math classes. We can consider apolynomial of one variable (x) to be a list of terms, with each term consisting of two parts: a coe±cient andan exponent. For example, the polynomial 2x3-1 +x-4has three terms, 2x3,-1x0, and 1x-4. In the ²rstterm, the coe±cient is 2 and the exponent is 3; in the second, they are-1 and 0, respectively. Using an arrayof term objects as our polynomial representation, we will represent this sample polynomial with an array ofjust three elements. No terms with coe±cients of zero are stored.As a polynomial is a collection of terms, a polynomial class is likely to have methods dealing with the generalissue of term quantity; for example, the number of terms in the polynomial. And, lots of other classes arelikely to need quantity-related methods, too. Sounds like a job for .. . an interface!Assignment:Implement the following four componentsin separate .java fles:1. The classTerm. ATermobject represents a term of a polynomial. The implementation details ofTermare up to you, with the understanding that these objects exist to support the needs of yourPolynomialclass (see below). (Of course, we expect that you will create a well–designed, well–implemented, andwell–documentedTermclass!)2. The interfaceQuantity. This interface speci²es that these instance methods be de²ned by any classimplementing it:•boolean isEmpty()— Returns true if this object currently has no members, false otherwise.•boolean isFull()— Returns true if this object currently has no available space for additionalmembers, false otherwise.•int holding()— Returns the quantity of members currently held by the object.3. The classPolynomial, which implements theQuantityinterface. It is to have just one constructor:•Polynomial()— Create an empty (termless)Polynomial.The twelve public methods of this class are:•Polynomial add(Polynomial p)— Mathematically add the polynomial p to the currentPolynomial,returning a newPolynomialobject without changing either of the existingPolynomialobjects. IfbothPolynomialobjects possess terms with matching exponents, sum each pair of matching terms.•void addTerm(int c, int e)— Add to the currentPolynomiala term with coe±cient c andexponent e. If a term with exponent e already exists, sum the terms and replace the old coe±cientwith the sum.•Polynomial replicate()— Create a newPolynomialthat possesses a copy of the content of thecurrentPolynomialusing a completely new collection of objects.•boolean equals(Polynomial p)— Returns true if p has the same number of non–zero terms withthe same coe±cients and same exponents as thisPolynomial, false otherwise.(Continued ...)

Attachments:

Answers

(11)
Status NEW Posted 29 May 2017 07:05 AM My Price 11.00

-----------

Not Rated(0)