Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please read the instructions on How to Prepare and Submit Assignments. This assignment will give you an opportunity to practice your work with C +

Please read the instructions on How to Prepare and Submit Assignments.
This assignment will give you an opportunity to practice your work with C++ classes. It is designed to make sure that everyone is starting from a level where they can move forward successfully into CS361.
This assignment does not require any C++ skills/knowledge not covered in CS250/333 and CS252. If your memories are rusty, however, or if you transferred CS250 credits from some other college, or if you cruised through the final third of CS250 on the strength of strong grades in the first 2/3, this is a good opportunity for review before we move on to new material.
1 Instructions
Read the problem description below.
Get the files for this assignment. Compile the program as is to familiarize yourself with it. You will receive error messages. Read them. They are hints as to what is missing from the current code.
Your focus in this assignment will on the implementation of the Polynomial class in files polynomial.h and polynomial.cpp. This class stores the set of coefficients that define a polynomial (e.g.,1+2x+4x3
).
Although the immediate use of Polynomial is in support of this polyfactor program, we anticipate the possibility that Polynomial may be reused in other future projects, so we want to make sure that it is designed and implemented to facilitate that reuse.
You must not change the private data members in polynomial.h.(You may, if you wish, add additional private function members if doing so would aid you in completing the implementation.)
You may need to change some of the public functions in polynomial.h, but keep in mind that the Polynomial class must continue to compile with the other code in this program.
Your code will be evaluated both on its ability to function correctly within the polyfactor application (the systems tests) and on its ability to pass the various unit tests provided.
You are not limited to using my system tests. Its always a good ide ato run the program on data of your own choosing as well.
In the test report,
Tests with names beginning with sm are systems tests, including checks for memory leaks and other memory errors.
Other tests with names beginning with s are systems tests, ignoring memory leaks.
Tests with names beginning with um are unit tests, including checks for memory leaks and other memory errors.
Other tests with names beginning with u are unit tests, ignoring memory leaks.
Submit your assignment by committing your changes and pushing them to GitHub. After the assignment due date has passed, your most recent push will be graded by the instructor.
2 Assignment management
2.1 Actions
Get the starting code for this project and register your GitHub repository.
View your current grade report..
A request for a preliminary grade report will be automatically filed each time you push changes to your repository.
It may be several minutes before grading begins, depending on how many requests are in front of yours. Grading itself can take anywhere from a few seconds to many minutes.
On rare occasions the request from GitHub to our servers may fail. Also, your web browser may have cached the old report and be showing that to you.
If more than an hour has passed since you last pushed changes, and your grade report has not updated, you should:
Clear your browsers cache (files only, not cookies or history) and then try to view the grade report again.
If that does not work, request preliminary grading of your most recent push.
View the solution.
2.2 Files that you may change:
polynomial.h
polynomial.cpp
3 Problem Description
Computer software can be as adept at manipulating formulas as it is at evaluating them.
This assignment centers on a program that generates manipulates polynomials. In particular, it deals with the problem of factoring a polynomial into smaller polynomials that can be multiplied together to yield the original. You almost certainly spent a lot of time learning to do this when you learned algebra (and you probably did not enjoy it very much).
3.1 The Application Program
The program, polyfactor, reads a polynomial from the command line and makes a list of all linear factors (factors of the form ax+b
, where a
and b
are integers). The input is given as a list of integers representing the coefficients of each term, starting from the highest degree term and then down to the constant term.
For example, you could try to factor the polynomial 24x3+8x26x2
like this:
./polyfactor 248-6-2
You should see the output:
Attempting to factor: 24x^3+8x^2-6x -2
factor: 2x +1
factor: -2x +1
factor: -6x -2
because
24x3+8x26x2=(2x+1)(2x+1)(6x2)
Or you might try to factor x31
and see:
./polyfactor 100-1
Attempting to factor: x^3-1
factor: -x +1
could not factor: -x^2- x -1
because
x31=(x+1)(x2+x+1)
The program cannot do all possible factorizations, however:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions