Type Casting Needed 26 56.0 26 182.0 20 10 10 20: How Many Objects Are Eligible For Garbage Collection?
Type Casting Needed 26 56.0 26 182.0 20 10 10 20: How Many Objects Are Eligible For Garbage Collection?
Q1. The Charity Collection Box contains money in different currencies - dollars-cents or pounds-pence or
rupees-paise. All of these currencies have notes and coins. The note and coin numbers are counted
when they are added based on their value (that is number of 5 rupee notes, or $1 dollar note).
Create a super class representing Currency is created with different denomination for of notes
and coins and subclasses Dollar, Pound and Rupee has conversion methods to rupees, print()
and compute().
Create a class called CollectionBox that allows entry of these currencies in terms of number of
notes and coins of different denomination. Create a display method that allows any of these
currency types and displays the total amount collected in terms of Rupees. (Assume1 dollar= Rs.
50 and 1 pound = 78).