Click to follow our Afritutor YouTube Channel, subscribe and click notifications and get updates on new learning videos
<=Back
Write a C++ program that would define an abstract base class named bill with data member named units and standingfees, a member function named init( for initializing standingfeee and units) and a polymorphic function for determining the consumption costs.
The program should implement the polymorphic function in two derived classes named water and electricity based on the following information:
• The standing fees for water and electricity is 50 and 200 respectively;
• 100 units consumed for both water and electricity;
• Consumption cost for water =standingfees+(units*100);
• Consumption cost for electricity = standingfees*(units*2);
The program should output the consumption costs for water and electricity. (8 marks)
Use pointers where applicable.
 Viewed: 234 times For Better experience and learning,for video answers, after video ends playing, click next question in the questions list!!!
Share in: