Question No.
Smart Taxation System using Multiple Inheritance
The government wants to develop a Smart Taxation System to calculate taxes for citizens.
Different types of taxes are applied on a taxpayer’s income.
The system should calculate:
• Income Tax = 15% of total income
• Luxury Tax = 8% of total income
Both taxes should then be combined to calculate the final payable tax and the remaining
income after deductions.
You are required to implement this system in C++ using Multiple Inheritance and resolve
the Diamond Problem using Virtual Inheritance.
Class Structure
TaxPayer
/ \
IncomeTax LuxuryTax
\ /
FinalTax
Requirements
1. Create a base class named TaxPayer containing:
o A protected data member income
o A constructor to initialize income
2. Create a derived class IncomeTax that:
o Virtually inherits from TaxPayer
o Contains a function to calculate 15% income tax
3. Create another derived class LuxuryTax that:
o Virtually inherits from TaxPayer
o Contains a function to calculate 8% luxury tax
4. Create a class FinalTax that:
o Inherits from both IncomeTax and LuxuryTax
o Calculates:
▪ Income Tax
▪ Luxury Tax
▪ Total Tax
▪ Remaining Income
5. Display all calculated values properly.
Sample Output
Enter Total Income: 100000
Income Tax: 15000
Luxury Tax: 8000
Total Tax: 23000
Remaining Income: 77000
Question No. 2
Restaurant Billing System using Virtual Inheritance
A restaurant offers multiple discounts to its customers during weekends and for VIP
members.
The restaurant provides:
• VIP Customer Discount = 10% of the bill
• Weekend Discount = 7% of the bill
The system should calculate the total discount and display the final payable amount after
applying both discounts.
You are required to implement this system in C++ using Multiple Inheritance and solve the
Diamond Problem using Virtual Inheritance.
Class Structure
RestaurantBill
/ \
VIPCustomerDiscount WeekendDiscount
\ /
FinalRestaurantBill
Requirements
1. Create a base class named RestaurantBill containing:
o A protected data member billAmount
o A constructor to initialize bill amount
2. Create a class VIPCustomerDiscount that:
o Virtually inherits from RestaurantBill
o Calculates 10% VIP discount
3. Create another class WeekendDiscount that:
o Virtually inherits from RestaurantBill
o Calculates 7% weekend discount
4. Create a class FinalRestaurantBill that:
o Inherits from both discount classes
o Calculates:
▪ VIP Discount
▪ Weekend Discount
▪ Total Discount
▪ Final Payable Bill
5. Display all values neatly.
Sample Output
Enter Total Bill Amount: 5000
VIP Discount: 500
Weekend Discount: 350
Total Discount: 850
Final Payable Bill: 4150