Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++, write this program I am wondering how to code this program, it is also important to cover all general specifications and no external

In C++, write this program

I am wondering how to code this program, it is also important to cover all general specifications and no external libraries are allowed except iostream, string, sstream and object-oriented principles must be considered. The program is used to differentiates an equation.

The program also emphasizes on linked-list, hence the requirements are also listed. Thanks

This program is designed using C++.

image text in transcribed

image text in transcribedimage text in transcribed

GENERAL SPECIFICATIONS: ERROR CHECK 1: Number of User Input Arguments If the number of user input arguments 0, your program must display the student ID strings in the given form If the number of user input arguments 1, the program should proceed to the next check If the number of user input arguments >= 2, your program must output an appropriate message to the console ERROR CHECK 2: Valid Equation Input The input equation into the program must be checked for validity. As stated, there must be no whitespaces anywhere in the equation and the constants a and b can be assumed to be integer values only. Only the terms listed on the previous page will be considered, other terms will be considered as invalid input. An example of a valid input equation is also provided on the previous page. Invalid input equations must be rejected and an appropriate message, stating the error, must be displayed to the console. ou mut es urcodele The olodi spe d implemented The terms in the input equation must be stored in a linked-list A hierarchy of classes must be constructed which forms all the valid terms in the equation. You will need to consider this part carefully-which terms are more specialized than others? You should also consider intermediate classes in the hierarchy, such as polynomial and trigonometric as two examples. Your code must make use of virtual functions for the behaviours which need redefining in the derived classes s rule needs to be considered for deciding whether inheritance or aggregation make sense If it makes sense to do so, other object-oriented principles should also be considered. You are required to write a C++ program which differentiates an equation that is passed into a console program as a command line argument. The equation can contain any number of terms, where any of the following terms are valid Power: a* x*(b) Exponential: a * e^(b * x) Exponential: a * e"(x) Linear: a*x Logarithmic: alog10(x) Logarithmic: a loge(x) Sinusoidal: a *sin(x) Co-sinusoidal: acos(x) Constant: a Logarithmic: alog10(b * x) Logarithmic: a loge(b *x) Sinusoidal: a sin(b* x) Co-sinusoidal: a cos(b *x) Each term can only be separated by a or - sign and no whitespaces must exist in the equation. In each of the terms, x is the independent variable, a and b are constants and can be assumed to be integer values. An example of how an equation can be is 3xA89 log10 (8x)-4sin (2 x)- loge(x) 7 e (5 x) From the command line, your program can be executed in one of the two following ways: laboratory2groupxX.exe laboratory2_groupXX.exe fx where XX denotes your group number where XX denotes your group number If ONE parameter is entered via the command line, laboratory2_groupXX.exe fx, where fx is the equation and XX is your groups number, your program must determine the derivative of the input equation and display the result to the console If TWO parameters are entered via the command line, laboratory2_groupXX.exe fx a, where fx is the equation, a is an arbitrary input and XX is your groups number, your program must exit with an error code where an appropriate statement is output to the console which states the error The only output which can be displayed in the command line is a) the resulting equation b) an error message which clearly and concisely states the error which has occurred. NO debug code must appear in the console window When your program is run without any user input arguments, i.e. laboratory2_groupXX.exe, each student ID string must be displayed to the console in the following form GENERAL SPECIFICATIONS: ERROR CHECK 1: Number of User Input Arguments If the number of user input arguments 0, your program must display the student ID strings in the given form If the number of user input arguments 1, the program should proceed to the next check If the number of user input arguments >= 2, your program must output an appropriate message to the console ERROR CHECK 2: Valid Equation Input The input equation into the program must be checked for validity. As stated, there must be no whitespaces anywhere in the equation and the constants a and b can be assumed to be integer values only. Only the terms listed on the previous page will be considered, other terms will be considered as invalid input. An example of a valid input equation is also provided on the previous page. Invalid input equations must be rejected and an appropriate message, stating the error, must be displayed to the console. ou mut es urcodele The olodi spe d implemented The terms in the input equation must be stored in a linked-list A hierarchy of classes must be constructed which forms all the valid terms in the equation. You will need to consider this part carefully-which terms are more specialized than others? You should also consider intermediate classes in the hierarchy, such as polynomial and trigonometric as two examples. Your code must make use of virtual functions for the behaviours which need redefining in the derived classes s rule needs to be considered for deciding whether inheritance or aggregation make sense If it makes sense to do so, other object-oriented principles should also be considered. You are required to write a C++ program which differentiates an equation that is passed into a console program as a command line argument. The equation can contain any number of terms, where any of the following terms are valid Power: a* x*(b) Exponential: a * e^(b * x) Exponential: a * e"(x) Linear: a*x Logarithmic: alog10(x) Logarithmic: a loge(x) Sinusoidal: a *sin(x) Co-sinusoidal: acos(x) Constant: a Logarithmic: alog10(b * x) Logarithmic: a loge(b *x) Sinusoidal: a sin(b* x) Co-sinusoidal: a cos(b *x) Each term can only be separated by a or - sign and no whitespaces must exist in the equation. In each of the terms, x is the independent variable, a and b are constants and can be assumed to be integer values. An example of how an equation can be is 3xA89 log10 (8x)-4sin (2 x)- loge(x) 7 e (5 x) From the command line, your program can be executed in one of the two following ways: laboratory2groupxX.exe laboratory2_groupXX.exe fx where XX denotes your group number where XX denotes your group number If ONE parameter is entered via the command line, laboratory2_groupXX.exe fx, where fx is the equation and XX is your groups number, your program must determine the derivative of the input equation and display the result to the console If TWO parameters are entered via the command line, laboratory2_groupXX.exe fx a, where fx is the equation, a is an arbitrary input and XX is your groups number, your program must exit with an error code where an appropriate statement is output to the console which states the error The only output which can be displayed in the command line is a) the resulting equation b) an error message which clearly and concisely states the error which has occurred. NO debug code must appear in the console window When your program is run without any user input arguments, i.e. laboratory2_groupXX.exe, each student ID string must be displayed to the console in the following form

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

Concepts Of Database Management

Authors: Joy L. Starks, Philip J. Pratt, Mary Z. Last

9th Edition

1337093424, 978-1337093422

More Books

Students also viewed these Databases questions

Question

Understand the reasons for engaging consultants

Answered: 1 week ago