I just learn C++ . Any tutors for C++ programming available to chat and answer questions related to homework ? thanks
i think the attachment has been failed. just post the homework on the form, thanks. A CLASS FOR POLYNOMIALS PURPOSE In this assignment we develop a user‐defined C++ class to describe and manipulate polynomials. REQUIREMENTS 1. Your boss requests (wow, is she ever becoming demanding) that you complete the implementation of a C++ class Polynomial, which she has prescribed in the following manner: (hint, here’s a “second order polynomial in the variable x“ 3x2+6.5x+12) a. The declaration should match the public interface shown in the “incomplete” header file Polynomial.h . Note, the actual structure of the private members and methods of this class are up to you to design. b. The behavior of the class and its methods should duplicate that shown in the example test application TestThePolys.cpp and its associated program output. 2. a. Due date is Friday, March 13, 2008 at noon. b. Your solution should consist of at least four files. i. A C++ header file (Polynomial.h) to complete the declaration. ii. A complete C++ source code file to complete the Polynomial definition including definition of any friend functions required (Polynomial.cpp). iii. A C++ source code file for providing a “main” test application (TestThePolyEtc.cpp) which at least duplicates the boss’s desired behavior tests (again, note, it is strongly suggested that you carry out further tests of the class’s functionality). iv. A single text (.txt) file which contains demonstration dialog of your class and main program behavior. Page 2 Here’s the boss’s very incomplete specification for the public view of Polynomial: Just for practice, here are some more polynomials for you to consider. All are considered in the default variable x, which is okay with your boss. Example 1: A third order polynomial with the coefficient list of {34.2, 12.7, ‐8.4, 1} x38.4x2+ 12.7x+34.2 or equivalently 1x38.4x2+ 12.7x1+34.2x0 Example 2: A second order polynomial with the coefficient list of {12.0, 7.0, 0.5} 0.5x2+7.0x+12.0 or equivalently 0.5x2+7.0x1+12.0x0 MAJOR CLUE: You will need to implement some form of dynamic memory allocation in order to efficiently store a variable number of coefficients (the order of a polynomial might change). In particular, in the following test program, you should consider carefully what happens to enable the assignment D=C. For example, your class should also deal correctly with an assignment such as C=A if it were inserted at the bottom of main TestThePoly.cpp. Code: // Polynomial.h // Incomplete declaration of Polynomial class // Programming Assignment class Polynomial { friend ostream& operator<<( ostream& , const Polynomial& ); friend istream& operator>>( istream& , Polynomial& ); public: Polynomial(); Polynomial( int order, const double* coefficients ); Polynomial( const Polynomial& ); ~Polynomial(); const Polynomial& operator=( const Polynomial& ); bool operator==( const Polynomial& ) const; int getOrder() const;} // Beware, very, very incomplete! Here’s the boss’s test program, and the desired output follows on the last page: // TestThePoly.cpp // Minimum behavioral demonstration for class Polynomial // Programming Assignment #include <iostream> using std::cout; using std::endl; using std::cin; #include "Polynomial.h" int main() { Polynomial A; cout << "(1) First look at A: " << A << endl; cout << endl << "Enter the polynomial (int order then double coeffs): "; cin >> A; cout << endl; cout << "(2) Second look at A: " << A << endl; Polynomial B(A); cout << "(3) First look at B: " << B << endl; double clist[]={8, 4.5, 1}; Polynomial C(2, clist); cout << "(4) First look at C: " << C << endl; Polynomial D=C; cout << "(5) First look at D: " << D << endl; cout << "(6) Testing A == B : " << (A==B ? "TRUE" : "FALSE") << endl; cout << "(7) Testing A == D : " << (A==D ? "TRUE" : "FALSE") << endl; return 0; } The results: C:\Temp\TestThePoly\Debug> TestThePoly (1) First look at A: empty Enter the polynomial (int order then double coeffs): 3 1 4.5 7.6 21.1 (2) Second look at A: 1 x^(3) + 4.5 x^(2) + 7.6 x^(1) + 21.1 x^(0) (3) First look at B: 1 x^(3) + 4.5 x^(2) + 7.6 x^(1) + 21.1 x^(0) (4) First look at C: 1 x^(2) + 4.5 x^(1) + 8 x^(0) (5) First look at D: 1 x^(2) + 4.5 x^(1) + 8 x^(0) (6) Testing A == B : TRUE (7) Testing A == D : FALSE C:\Temp\TestThePoly\Debug>
If you don't know where to start try writing some elementary programs like taking input from user and displaying it or taking number as input and decide on if its odd or even number ....