Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Psuedocode for: Objectives : Implement a linked list using classes Create multiple classes that interact Implement recursive procedures on a simple data structure Problem: Gearbox

Psuedocode for:

Objectives: Implement a linked list using classes Create multiple classes that interact Implement recursive procedures on a simple data structure Problem: Gearbox Software in Frisco is working on a new physics engine to use with future games. As a recently hired intern, you have been assigned to the team building the physics engine. Your job is to create a program to evaluate polynomial expressions used by the engine.

Pseudocode Details: Describe your logic for parsing the lines in the file Describe your logic for calculating the value of the expression Describe the logic of your main function Details: Each expression will be a simple polynomial expression. The only operators will be addition (+) and subtraction (-) Spaces will surround the operators The expression may not be in standard form (exponents ordered from largest to smallest) Each expression will contain one or more terms. The term may not have a coefficient. o If no coefficient is present, the coefficient is 1. The coefficient may be an integer or floating point. If a coefficient is present, it will immediately be followed by the variable x. The term may not have an exponent (constant value) If an exponent is present o Variable will be followed by a carat (^) no space o The exponent will be an integer value Expressions may contain terms with the same exponent o If so, combine like terms

Store each expression in a linked list (-10 points if linked list not used) Each node of the linked list will contain one term of the expression Comment your code generously. Refer to the grading rubric for more details. Use as few variables as possible. Dont waste memory holding a calculation just so you can print it out one time.

Class Details Node class (-5 points if not implemented)

o Attributes ? Coefficient ? Exponent ? Next pointer

o Methods ? Default constructor ? Overloaded constructor Pass in coefficient and exponent ? Accessors ? Mutators

Linked List (-5 points if not implemented)

o Attributes ? Head node pointer

o Default constructor

o Overloaded constructor ? Takes node and assigns head to point at the node passed in o Destructor ? Delete linked list ? EXTRA CREDIT delete the list recursively (+5 points)

o Accessor

o Mutator

o Insert ? Add node to linked list ? You can build the function to insert anywhere in the linked list Or reuse the code from project 3 to insert and sort the list o Print ? Recursively print out the list to the file ? EXTRA CREDIT implement an overloaded << operator (+5 points) The overloaded operator is not recursive

User Interface: There will be no user interface for this program. All I/O will be file based.

Input: All input will be read from a file named poly.txt. Each line of the file will contain a single expression The expression will be formatted as follows: o f()= The number in parentheses may be integer or floating-point. The number in parentheses will be used to evaluate the expression.

Output: All output will be written to a file named answers.txt. Each line will contain the polynomial expression and the evaluated answer. Write the original expression in standard form (highest to lowest exponent). The format of the line will be as follows: o = All values will be rounded to 3 decimals.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

OpenStack Trove

Authors: Amrith Kumar, Douglas Shelley

1st Edition

1484212215, 9781484212219

More Books

Students also viewed these Databases questions