Specifications:

In this project you are required to write thejava programPoly.javato implementinteger polynomials, andthreeoperations+,-,*, respectively.

Specifically, your program will read two polynomials from a file named input.txt (under the same directory of the program). Then your program should create a file named output.txt (under the same directory of the program) and write the results to output.txt. Please check the attached sample files input.txt and output.txt.

In input.txt:

  • Firstline is the degree of f(x).
  • Second line is the coefficients of f(x), from the leading coefficient to the constant, separated by one blank space.
  • Third line is the degree of g(x).
  • Fourth line is the coefficients of g(x), from the leading coefficient to the constant, separated by one blank space.

In output.txt:

  • First line is the coefficients of f(x)+g(x), from the leading coefficient to the constant, separated by one blank space.
  • Second line is the coefficients of f(x)-g(x), from the leading coefficient to the constant, separated by one blank space.
  • Third line is the coefficients of f(x)*g(x), from the leading coefficient to the constant, separated by one blank space.

Remark: The leading coefficient should not be 0 unless the polynomial is 0.

Example 1: if f(x) = 2x andg(x) = -2x + 1, then f(x) + g(x) = 1 instead of 0x + 1. Thus the first line of output.txt should be 1 instead of 0 1.

Example 2: if f(x) = 2x + 2, g(x) = -2x-2, then f(x) + g(x) = 0 instead of 0x + 0. Thus the first line of output.txt should be 0 instead of 0 0.

Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.