Copyright © – Sudharsan Iyengar
CS – 341 Spring
2024 Individual Programming Assignment:
#1. Due Date: 2/4/2024
2-Variable Polynomials:
Dept. collaboration policy applies to this assignment. You are welcome to discuss the problem-solving process. The coding should be done individually.
You are required to write an application that will manage polynomials that have two variables’ operations. A polynomial is made up of multiple terms of the form
Ak * Xi
* Yj Where Ak is
constant, Xi represents X to the power i and Yj
represents Y to the power j.
Your application will open a text file – poly.dat. The first line will contain the number of polynomials described. Each line after that has the number of terms, followed by the terms – constant, power of X and power of Y.
Example: 3
2 5 2 2 3 1 0
5 3 2 2 4 2 1 4 1 2 5 1 1 8 0 0
1 8 3 3
This file describes 3 polynomials.
The first polynomial has 2 terms and is 5 * X2 * Y2 + 3 * X
The second polynomial has 5 terms and is 3 * X2 * Y2 + 4 * X2 * Y + 4 * X * Y2 + 5 * X * Y + 8
The third polynomial has 1 term and is 8 * X3 * Y3
Write an application that will create and store polynomials and provide user with menu driven options to choose and perform operations on those polynomials (and output the result), repetitively until the user chooses exit.
a. Output the list of polynomials (read and maintained by the application)
b. Evaluate a chosen polynomial (requests an integer value for X and Y).
c. Add two chosen polynomial and display the resultant polynomial
You can output the terms of the polynomial as 5 * X^2 *Y^2. Assume there are more than 10 terms and that the degree of X and Y is no more than 5. Similar terms should be added into one term.
In the Comment part of your code, you must include the following
Your name, the assignment number for this program
Test your program for various possible input data files. Your program must run for any valid test data file.
You should export
your project to your folder for this class by midnight at the end of the due
date.