Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Accounting Basics Expert

Task

Linked lists are a convenient way to represent polynomials. Your task is to design a program that does some polynomial operations using a linked list.

A polynomial of degree ?? is defined as,

a0xm+a1xm-1+...+ am-1x1+am

The degree ?? is the largest exponent in any of the terms of the polynomial. For example, the largest exponent in 4x2-7x+3 is 2.

It is customary to write the term with the largest exponent first, followed by the term with the next largest exponent and so on.
ai s are the coefficients of the polynomial. One example of a polynomial of degree 6 is

2x6+x3+5x+4

in which the first term's coefficient is a0=2 and its power is 6; the second term's coefficient is a1=1 and its power is 3.

Tasks are detailed as follows

You are required to develop your own class to represent polynomials as a linked list. The first node in the list represents the first term in the polynomial, the second node represents the second term, and so forth.
Each node contains three fields. The first field is the term's coefficient. The second field is the term's power, and the third field is a pointer to the next term.

The following examples show how a polynomial is represented as a linked list.
5x4+6x3+7

2x3-7x2+3x

Notice that in the linked list:
1. The list has as many nodes as there are terms in the polynomial.
2. Each node in the linked list contains a value for the coefficient, a value for the exponent and a reference.
3. The nodes in the linked list are ordered. Nodes with a higher exponent precede nodes with a lower exponent.
4. The constant term has an exponent of 0.
5. The reference of the last node is NULL.

What to Implement (Task):

You should have at least two constructor for polynomials. One is used to build a polynomial (linked list) from a file and the other from keyboard input (pairs of coefficients and powers) by a user.
Implement polynomial addition by using an add() method, so you could write in program :
PolynomialThree= PolynomialOne.add(PolynomialTwo);

The rules for the addition of polynomials are as follows:
1. If the powers are equal, the coefficients are algebraically added.
2. If the powers are unequal, the term with the higher power is inserted in the new polynomial.
3. If the exponent is 0, it represents x0, which is 1. The value of the term is therefore the value of the coefficient.
4. If the result of adding the coefficients results in 0, the term is dropped (0 times anything is 0).
For example, the polynomial sum (27x3+15x2+12x)+(18x2+10x+8)is calculated as

27x3+33x2+22x+8

Get the value of a polynomial given an input. For instance, given x=2, the value of the polynomial x2+3x+2 is 12 .
Implement the product of a polynomial by another polynomial which is the algebraic sum of the products of one polynomial by all the monomials of another polynomial.
Implement the derivative operation for a polynomial. Note that for a monomial axk, its derivative is kaxk -1and the derivative of a constant is 0 and the derivative of a polynomial is equal to the sum of derivatives of its all monomials.
Implement a InsertTerm() method. This method should put the input term into a polynomial.
Test your program with the following two polynomials
12x9+5x6+13x5-4x4+2x3+11x2 - 6

7x9+2x8+5x6+2x5+2x3+9x2 - 7x

Write a driver program to test all the functionalities that you have defined

Accounting Basics, Accounting

  • Category:- Accounting Basics
  • Reference No.:- M91592882
  • Price:- $15

Priced at Now at $15, Verified Solution

Have any Question?


Related Questions in Accounting Basics

Question - assume that on january 1 2017 elmers restaurants

Question - Assume that on January 1, 2017, Elmer's Restaurants sells a computer system to Liquidity Finance Co. for $680,000 and immediately leases the computer system back. The relevant information is as follows. 1. The ...

Problem - one of the worst cases of aquatic pollution

Problem - One of the worst cases of aquatic pollution occurred on March 24, 1989, when the oil tanker Exxon Valdez ran into a reef in Prince William Sound, Alaska, spilling 11 million gallons of oil into the sea, with de ...

Question - texas roadhouse opened a new restaurant in

Question - Texas Roadhouse opened a new restaurant in October. During its first three months of operation, the restaurant sold gift cards in various amounts totaling $2,900. The cards are redeemable for meals within one ...

Question - morbes magazine is a magazine publisher who

Question - Morbes Magazine is a magazine publisher who began their operations on April 1, 2018. On this date, Morbes sold 40,000 one-year subscriptions, with each subscriber paying $36. Subscribers are required to pre-pa ...

Question - mark and patricia report adjusted gross income

Question - Mark and Patricia report adjusted gross income of $410,000 and itemized deductions of $31,000 for the interest on their home acquisition mortgage (principal amount of $890,000 acquired in 2015), $14,000 in sta ...

Accounting question - financial data for joel de paris inc

Accounting Question - Financial data for Joel de Paris, Inc, for last year follows Joel de Paris, Inc Balance Sheet   Beginning Balance Ending Balance Assets Cash $125,000 $133,000 Accounts receivable 348,000 483,000 Inv ...

Question - in 2002 the executives at telecommunications

Question - In 2002, the executives at telecommunications giant WorldCom perpetrated accounting fraud that led to the largest bankruptcy in US history. The company improperly booked about $4 billion as capital expenditure ...

Question - on january 1 2017 shay issues 700000 of 10

Question - On January 1, 2017, Shay issues $700,000 of 10%, 15-year bonds at a price of 97¾. Six years later, on January 1, 2023, Shay retires 20% of these bonds by buying them on the open market at 104½. All interest is ...

Question - bowcutt company sold 400000 of 7 percent bonds

Question - Bowcutt Company sold $400,000 of 7 percent bonds on January 1, 2018, when the effective rate of interest was 6%. The bonds will mature in five years, and pay interest on June 30 and December 31. Using the effe ...

Question - if you earned an income of 36500 in wages and

Question - If you earned an income of $36,500 in wages and other contractual income of $42,600 working under your own ABN, making a net profit of $38,500, what would be your total assessable income?

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As