Purchase Solution

A C++ implementation of a polynomial class.

Not what you're looking for?

Ask Custom Question

Do this exercise in C++ language, prefer use Visual C++ or DevC to compile.

Exercise 6.3: A polynomial of degree n has the form

Where are numeric constants called the coefficients of the polynomial and #0.

For example:

is a polynomial of degree 4 with integer coefficients 1, 3, 0, -7 and 5. One common implementation of a polynomial stores the degree of the polynomial and the list of coefficients. This is the implementation to be used in the exercises that follow. As you add the various operations to the Polynomial class you are building, you should also write a program to test your class.

1. Write a declaration for a Polynomial class whose data members are an integer for the degree and an array for the list of coefficients and with basic operations of input and output.
2. Implement the input operation in Question 1
3. Implement the output operation in Question 1. Display the polynomial in the usual mathematical format with displayed as x^n.
4. Add an evaluate operation to your Polynomial class that allows the user to enter a value for x and that calculates the value of the polynomial for that value.
5. Add an addition operation to your Polynomial class.
6. Add a multiplication operation to you Polynomial class.

Attachments
Purchase this Solution

Solution Summary

This solution provides a C++ class that implements a polynomial and the common polynomial functions.

Solution Preview

This solution revolves around the creation of a C++ class that
implements a polynomial. The class contains two data members: degree,
and coefficients. The degree indicates the degree of the polynomial
as described in ...

Purchase this Solution


Free BrainMass Quizzes
Javscript Basics

Quiz on basics of javascript programming language.

C++ Operators

This quiz tests a student's knowledge about C++ operators.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.