Answered You can hire a professional tutor to get the answer.

QUESTION

The first programming project involves writing a program that merges two files that contain polynomials. To merge two files, the input files must be...

The first programming project involves writing a program that merges two files that contain polynomials. To merge two files, the input files must be in sorted order. If the polynomials stored in one of the files are not in ascending order, an exception should be thrown and project execution should stop.The merge operation repetitively selects the smaller value from the two files. When two sorted files are merged, the result will be sorted.The input files contain one polynomial on each line. A polynomial is represented in the input file as integer pairs that represent a coefficient and its corresponding exponent. For example 5 3 4 1 8 0 represents the polynomial 5x3 + 4x + 8. A polynomial will always be written from the highest exponent to the lowest. Exponents with zero coefficients will be omitted.Polynomial comparison should be similar to the Big-O comparison of methods. If the two polynomials have different highest order exponents the one with the highest exponent is the greatest. If their highest exponents are the same, their coefficients are compared. If two polynomials have the same highest order exponent with the same coefficients, the next highest exponent is examined. The following examples should help explain the ordering:6x4 + 7x2 + 3 > 20x3 + 8x2 + 107x4 + 7x2 + 3 > 6x4 + 17x2 + 7x + 306x4 + 9x2 + 3 > 6x4 + 7x +9

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question