and each of the are seprate cpp dont use namespace std problem is in the pic q to exit out

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

and each of the are seprate cpp dont use namespace std problem is in the pic q to exit out

Post by answerhappygod »

and each of the are seprate cpp
dont use namespace std
problem is in the pic
q to exit out
And Each Of The Are Seprate Cpp Dont Use Namespace Std Problem Is In The Pic Q To Exit Out 1
And Each Of The Are Seprate Cpp Dont Use Namespace Std Problem Is In The Pic Q To Exit Out 1 (41.64 KiB) Viewed 36 times
And Each Of The Are Seprate Cpp Dont Use Namespace Std Problem Is In The Pic Q To Exit Out 2
And Each Of The Are Seprate Cpp Dont Use Namespace Std Problem Is In The Pic Q To Exit Out 2 (88.8 KiB) Viewed 36 times
And Each Of The Are Seprate Cpp Dont Use Namespace Std Problem Is In The Pic Q To Exit Out 3
And Each Of The Are Seprate Cpp Dont Use Namespace Std Problem Is In The Pic Q To Exit Out 3 (50.69 KiB) Viewed 36 times
And Each Of The Are Seprate Cpp Dont Use Namespace Std Problem Is In The Pic Q To Exit Out 4
And Each Of The Are Seprate Cpp Dont Use Namespace Std Problem Is In The Pic Q To Exit Out 4 (71.47 KiB) Viewed 36 times
And Each Of The Are Seprate Cpp Dont Use Namespace Std Problem Is In The Pic Q To Exit Out 5
And Each Of The Are Seprate Cpp Dont Use Namespace Std Problem Is In The Pic Q To Exit Out 5 (23.63 KiB) Viewed 36 times
And Each Of The Are Seprate Cpp Dont Use Namespace Std Problem Is In The Pic Q To Exit Out 6
And Each Of The Are Seprate Cpp Dont Use Namespace Std Problem Is In The Pic Q To Exit Out 6 (46.25 KiB) Viewed 36 times
And Each Of The Are Seprate Cpp Dont Use Namespace Std Problem Is In The Pic Q To Exit Out 7
And Each Of The Are Seprate Cpp Dont Use Namespace Std Problem Is In The Pic Q To Exit Out 7 (68.94 KiB) Viewed 36 times
And Each Of The Are Seprate Cpp Dont Use Namespace Std Problem Is In The Pic Q To Exit Out 8
And Each Of The Are Seprate Cpp Dont Use Namespace Std Problem Is In The Pic Q To Exit Out 8 (79.73 KiB) Viewed 36 times
Programming problem: Currency Simulator A. Create an abstract base class called Currency with two integer attributes, both of which are nonpublic (Python programmers - it is understood that there is nothing private in Python but try to not access the attributes directly from outside the classes). The int attributes will represent whole part (or currency note value) and fractional part (or currency coin value) such that 100 fractional parts equals 1 whole part. B. Create two derived classes - Dollar and Pound with one additional non-public string attribute which will contain the name of the currency (Dollar or Pound) respectively. DO NOT add this attribute to the base Currency class. C. In your base Currency class, add public methods for the following, where appropriate (C++ students are allowed to use friend methods as overloads only, i.e. the corresponding class method needs to be defined first; Do not use overloaded operators in C ++ /Python):
- Default Construction (i.e. no parameters passed). - Construction based on one single input of type double - create logical objects only, i.e. no negative value objects allowed. - Copy Constructor and/or Assignment (i.e. the input is an object of the same class), as applicable to your programming language of choice. - Destructor, as applicable to your programming language of choice. - Setters and Getters for all attributes, as may be necessary.
- Construction based on one single input of type double - create logical objects only, i.e. no negative value objects allowed. - Copy Constructor and/or Assignment (i.e. the input is an object of the same class), as applicable to your programming language of choice. - Destructor, as applicable to your programming language of choice. - Setters and Getters for all attributes, as may be necessary. - A method called add for adding an input object of the same currency. - A method called subtract for subtracting an input object of the same currency - the result should be logical, i.e. negative results are not allowed. - A method called isEqual for comparing an input object of the same currency for equality/inequality. - A method called is Greater for comparing an input object of the same currency to identify which object is larger or smaller. - A method called toString to 'stringify' the name and value of a currency object in the form "xx.yy" followed by the derived currency name, e.g. 1.23 Dollar or 2.46 Pound. - All of the above should be instance methods and not static. - The add and subtract as specified should manipulate the object on which they are invoked. It is allowed to have overloaded methods that create and return new objects.
D. In your derived Dollar and Pound classes, add new methods or override inherited methods as necessary, taking care that code should not be duplicated or duplication minimized. Think modular and reusable code.
- Make sure not to print anything to console from within any class. All print statements should be limited to main only. - Throw String (or equivalent) exceptions from within the classes to ensure that invalid objects cannot be created or objects cannot be modified to become invalid. - In all methods, ensure that you are not mixing objects of different currencies.
- Declare a primitive array of 2 Currency references (for C++ programmers, array of 2 Currency pointers). - Set the first reference in the array to a Pound object and the second reference to a Dollar object, both of zero value. - Then perform the sequence of operations as in the sample input/output below, understanding that your program will be tested with a different sequence of operations using the same patterns. - All operations in the main should be performed on Currency objects demonstrating polymorphism. - Remember to handle exceptions appropriately. - Sample input / output for your main - remember
Things to remember: - Create exactly four code files - one each for the Currency, Dollar and Pound classes and one for the main. For C++ students, code your class declarations and definitions in the same file. - The files should be named 'currency. xxx′, 'dollar.xXX', 'pound.xXX' and 'lab2main. xXX ' with the appropriate extension in place of xxx. - Your 3 currency classes should have pre/post documentation for the methods that are not constructors / destructors / setters / getters. See Design Tools and Documentation.pdf for documentation help on what pre/post is needed. - No pseudocode is needed for any class or main. - Include a separate PDF file which contains the UML diagram including the relationship designators for the 3 classes. - Also, remember to include name blocks in all the code files. - For the submission, name your zip file as 'lab2.zip'. - Your zip file should only contain 4 code files, the UML PDF and as many screenshots as needed to clearly demonstrate the above sample in an easy to read magnification. For any additional file or folders (when unzipped on a windows machine) or non-specified file types, submission related deductions will be made.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply