You are on page 1of 2

UNIVERSITY OF GUJRAT

Mid Term Exam – Spring 2020

Course: Object Oriented Programming (IT-105) Roll No: _______________


Total Marks: 25 Time Allowed (min): 120

Question No 1: Write a C++ program that will find out the total amount of a customer's bill
according to the items purchased. i.e. Create two classes: Cart_Item, Bill [10]
1.The Cart_item should be having the 2. Class Bill should have two data members
following data members
i. total_amount //for the total amount of bill
i. item_num //for item number ,it should be that is to be paid
static
ii. items[5] //an array of Cart_item; should be
ii. price //for per unit price 5 size
iii. quantity //for quantity purchased class Bill should have a member function(s)
for input of 5 Items and for calculation of the
Class Cart_item should have AddItem()
total amount and assign it to the data member ,
member function to take input from user
total_amount

Question No 2: A company pays its employees weekly. The employees are of three types:
Salariedemployees are paid a fixed weekly salary without finding the number of hours worked,
commission employees are paid a percentage of their sales and Basepluscommissionemployees
receive a base salary plus a percentage of their sales. For the current pay period, the company has
decided to reward base-salary-plus-commission employees by adding 10 percent to their base
salaries. The company wants to implement a C++ program that performs its payroll calculations
polymorphically. You are requested to use the following class hierarchies. [15]
Table mentions the data members and functionality of each class. Make two functions
earnings ( ) to calculate salary of each category of employees and print ( ) the related data
members mentioned in print table as well the calculated salary of each category of
employee. Use data of your own choice and print the values given in table.

You might also like