Page 1 of 1

Python Program for Currenct Simulator. Create 4 python code files for Currency, Dollar and Pound classes and one for the

Posted: Tue Jul 12, 2022 8:22 am
by answerhappygod
Python Program for Currenct Simulator. Create 4 python codefiles for Currency, Dollar and Pound classes and one for theMain.py
1) Create an abstract base classcalled Currency with two integer attributes,both of which are non-publicThe int attributes will represent wholepart (or currency note value) and fractional part (or currency coinvalue) such that 100 fractional parts equals 1 wholepart.
. In your base Currency class, addpublic methods for the following, where appropriate (C++ studentsare allowed to use friend methods asoverloads only, i.e. the corresponding class method needs to bedefined first; Do not use overloaded operators in C++/Python):
2 class files for Dollar.py and Pound.py
Create two derived classes- Dollar and Pound - with one additionalnon-public string attribute which willcontain the name of the currency (Dollar or Pound) respectively. DONOT add this attribute to thebase Currency class.In yourderived Dollar and Pound classes,add new methods or override inherited methods as necessary, takingcare that code should not be duplicated or duplication minimized.Think modular and reusable code.
In your main:
Invalid addition
1.11 Pound 12.12 Dollar
Invalid subtraction
1.11 Pound 2.25 Dollar