Question: Part I: Class Design Re - write the Formula class in C + + , the type definition of Formula is the same as in

Part I: Class Design
Re-write the Formula class in C++, the type definition of Formula is the same as in P1
Files must be named formula.h and formula.cpp
Write a second class, Plan, that represents a sequence of Formulas to be applied in order.
Files must be named plan.h and plan.cpp
A Plan should allow the client to:
Add a new Formula to the end of the sequence.
Remove the last Formula from the end of the sequence.
Replace a Formula anywhere in the sequence.
Use dependency injection to provide an initial sequence of Formulas. The Plan class must
properly implement C++ copy and move semantics. The Plan copy constructor and copy
assignment operator should support deep copying of all internal Formulas so that no
unintended aliasing occurs: e.g. after copying Plan object x, any actions on object x, such
as leveling up a Formula, should not affect any copy of x.
The Plan class must implement a destructor to appropriately dispose of owned resources.
Each Plan object encapsulates some number of distinct Formula objects, with addition, removal
and replacement of Formula objects supported as specified above thus the cardinality of Formula
subobjects varies across Plan objects. You decide what, if any, additional public functionality
should be supported., remembering that exposure should be minimized and queries should not
affect state.
Many details are missing. You MUST make and DOCUMENT your design decisions
Part II: Driver (p2.cpp)-- External Perspective of Client tests your class design
Fulfill the testing requirements as specified for the P1 driver -- use a collection of Plan objects
Unit testing is not required or expected.
Demonstrate copying of Plan objects via call by value and assignment
For an acceptable P2 submission:
1. use C++: the g++ compiler (C++17) on cs1 will be used to compile submissions
a. Submissions that do not compile on cs1 will NOT receive credit
b. programs developed in Visual Studio often do NOT compile on cs1
c. HIGHLY recommended to use C++ tools: g++, CLion, Xcode etc.
2. upload all .h and .cpp files to Canvas (no zip files AND do not use .hpp)
3. use submission script to upload and compile on cs1
/home/fac/sreeder/submit/cpsc5011/p2_runme
4. design using heap memory, composition, and move semantics
due to variable cardinality of internal Formula subobjects across the Plan objects,
use heap memory: do NOT design using excessive capacity

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!