|
|
|
Lab Sheet 3:
1. A hotel has 100 single and 200 double rooms at a basic charge of Rs. 3000 and Rs. 5000 per night respectively. The government levies an expenditure tax at 10% and a luxury tax at 30% of the basic charge on all rooms occupied. The hotel wants to calculate the total tax to be paid at the end of each day. Using (a) no friend functions and (b) friend functions, write a program to calculate this tax. 2. An organisation has 1000 employees. The organisation pays a salary to each employee. Also an employee can have other sources of income that includes agricultural income, consulting income and interest income. The accounts department computes tax for each employee at a flat rate of 30% if the income from all sources is above Rs. 50,000 per annum. Using (a) no friend functions and (b) friend functions, write a program to calculate this tax. 3. “A friend function violates the basic principles of O-O programming.” If it really does so, then why is it introduced in a C++? Which principles does it violate and how?
|
No responses found. Be the first to respond and make money from revenue sharing program.
|