Write a class polynomial that stores a polynomial create a


Homework 1 - C++ II Programming

A salesperson enters sales in a text file. Each line contains the following, separated by comas: The name of the client, the service sold (such as Dinner, Conference, Lodging, and so on), the amount of the sale, and the date of that event. Write a program that reads such a file and displays the total amount for each service category. Display an error if the file does not exist or the format is incorrect. The application should write separate files for each service category, containing the entries for that category along with descriptive statistics for that category (Min, Max, Range, Average, Std. Dev, and Variance). Name the output files Dinner.txt, Conference.txt, and so on.

Specifications -

The only user input required is the name of the input file.

Create a class that models a specific sale (name of client, service, amount, and date).

Create a class Sales that contains a vector or array of objects of the class defined above).

This class should have methods to filter the data, determine the stats for each type, etc.

The program should round results to two decimal places.

The program should display to the user the name of the files and the totals for each category.

Create a text file with 10,000 entries (you can use excel to generate random data)

Documentation - No document is required for this assignment, but make sure you document your code completely - that includes all comments for methods, attributes, etc...

Submitting your program -

You will submit this assignment on blackboard. You are allowed one submission. Submit your .cpp & .h files (not your entire project) and your input / output files.

Homework 2 - C++ II Programming

Write a class Polynomial that stores a polynomial such as

p(x) = 5x10 + 9x7 - x - 10

as a list of terms. A term contains the coefficient and the power of x. For example, you would store p(x) as a list like -

(5, 10), (9, 7), (-1, 1), (-10, 0)

Supply member functions to add, multiply, and get the polynomial as a string such as

p(x) = 5x^10 + 9x^7 - x - 10

Supply a constructor that makes a polynomial from a single term. For example, the polynomial p can be constructed as

Polynomial p(Term(-10, 0));

p.add(Polynomial(Term(-1, 1)));

p.add(Polynomial(Term(9, 7)));

p.add(Polynomial(Term(5, 10)));

Then compute the product by -

Polynomial q = p.Multiply(p); // or p * p;

cout << q.ToString(); // or cout << q;

Or the user can use the operators + and * as well as << to add, multiply, and display the polynomial.

Specifications -

Use the list or linked list data structures we created in class - modify them as needed to work with your polynomial.

Create a class Polynomial and Term.

Overload operators as necessary to solve the problem. At a minimum you will need the +, *, and << operator for the polynomial class.

Provide internal helper methods as needed to solve the problems of addition, multiplication, and converting to a string.

Document the running times of your operations (add, multiply, and string conversion) - be sure to explain in detail how the running time is determined.

Documentation - No document is required for this assignment, but make sure you document your code completely - that includes all comments for methods, attributes, etc...

Submitting your program - You will submit this assignment on blackboard. You are allowed one submission. Submit your .cc & .h files (not your entire project) and screenshots of your code running.

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Write a class polynomial that stores a polynomial create a
Reference No:- TGS02649732

Expected delivery within 24 Hours