NEEd help with that

profiledav30
softwareassignment.docx

You are required to write a console program(C++) which performs long division on polynomials, where the user enters the polynomials into the console program. The result (the quotient and remainder) is to be displayed to the console. The polynomials considered for this task will be of the form

where 𝑎𝑛 is the 𝑛𝑡ℎ coefficient of the 𝑛𝑡ℎ term in the polynomial. No restriction will be placed on the degree of the polynomial, i.e. 𝑛 can be any positive integer. The coefficients 𝑎𝑛 can be any positive or negative integer value (float values will not be assessed). The divisor is the polynomial by which another polynomial will be divided into, the dividend is the polynomial to be divided and the quotient is the result of dividing the divisor by the dividend, i.e.

The user must be asked by the console program to enter two polynomials, one for the dividend and the other for the divisor. The coefficients and index values are not allowed to be stored in your program code. Each polynomial must be entered in to the console program in the form

For example, 𝑥5+3𝑥2+1 must be explicitly entered in to the console program as

You will need to perform error checks to ensure that a valid polynomial has been entered in to your console program. A valid polynomial must meet the following criteria:

· • All coefficients must be integer values. If a non-integer coefficient is detected, your console program must exit with a message stating the exact error which has been found.

· • All powers must be integer values. If a non-integer power is detected, your console program must exit with a message stating the exact error which has been found.

· • Any illegal characters must be detected and rejected by your console program. A message stating the exact error found must be displayed to the console, followed by program termination.

· • Any term in the polynomial, where 𝑎𝑛=0, must not be entered in to your console program.

· • If the divisor is a higher degree polynomial than the dividend, your console program must terminate with an appropriate message displayed to the console.

You will be required to construct an algorithm to perform long division analytically. Numerical implementations are not allowed. You will also be required to perform long division using two different methods. Using the first method, the polynomial coefficients will be stored into a dynamic array where the index of the array is related to the degree of the polynomial term, e.g. the polynomial 10𝑥7+3𝑥5−5𝑥2+4 is to be stored into a dynamic array as

Using the second method, the polynomial coefficients and power terms are to be stored in a linked-list, where only the non-zero terms are stored, e.g. the polynomial 8𝑥9−2𝑥5−5𝑥2+20 is stored as

Your algorithm for performing the long division can be applied to the method using the dynamic array and the method using the linked-list. Each node in the linked-list will be a dynamically created instance of a class, where the class definition contains two integer variables, one for the power and the other for coefficient, and a pointer which points to the next node in the linked-list.

Once your program has determined the quotient and remainder, the results must be displayed to the console as

The executable file must be named in the form project_1234567.exe. The program should only take in one user argument from the command line. The input argument can only be 0 or 1. When project_1234567.exe 0 is executed from the command line, your program MUST print the ID string in the form 1234567 , [email protected] , Full_Name When project_1234567.exe 1 is executed from the command line, your program must function as normal, performing the required task. If any other user input argument is used, your program must terminate with a specific error message displayed to the console. If no, or more than two, input arguments are detected, your program must also terminate with a specific error message displayed to the console.

DELIVERABLES:

1. Flowchart which shows the operation of your console program. Your flowchart should contain adequate detail to completely demonstrate your long division algorithm.

2. C++ console program which performs long division on polynomials, as specified above.

3. A zip file containing your C++ source file, flowchart (pdf) and program executable file.

4. A discussion (no more than 1 page) which addresses the following statements a. State the advantages and disadvantages you have observed in using a dynamic array and a linked-list to perform long division of polynomials.

b. What assumption(s) would need to be made if a static array were used in place of a dynamic array?

c. What other error checking methods could be implemented to make your console application more robust and how would you go about implementing these?

d. If your program allowed float values to be entered in