University of Management and Technology Lahore: (SPRING 2021)
University of Management and Technology Lahore: (SPRING 2021)
TECHNOLOGY LAHORE
School of Systems and Technology
Submission Guidelines:
Time:
II. Explain the purpose of new and delete operator by using C++
program. (05 points)
V. What is inline function? When will you make a function inline and
why? (02 points)
Find the errors in following class and explain how to correct them:
1) class Example
2) {
3) public:
4) Example(int y = 10)
5) :data(y)
6) {
7) //empty body
8) } //end Example constructor
9) int getIncrmentedData() const
10) {
11) return data++ ;
12) } //end function getIncrmentedData
13) static int getCount()
14) {
15) cout << "Data is " << data ;
16) return count ;
17) } //end function getCount
18) private:
19) int data ;
20) static int count ;
21) }; // end class Example
Write a program to process weekly employee time cards for all employees
of an organization. Each employee will have three data items: an
identification number, the hourly wage rate, and the number of hours
worked during a given week. Each employee is to be paid time and a half
for all the hours worked over 40. A tax amount of 3.625 percent of gross
salary will be deducted. The program output should show the employee's
number and net pay. Display the total payroll and the average amount paid
at the end of the run.
Recall the swap function done in the class. Slightly modify the function
and rewrite it to do a three--‐way swap instead of simple swap. The
function will be passed three integers a, b and c. The function will put the
value of a in b, b in c and c in a.
Example:
a = 10, b = 15, c = 20
After function’s execution
a = 20, b = 10, c = 15
A year before the games begin, a Team of Staff are appointed to run the
day-to-day operations, including booking successfully assessed/safety-
checked venues. Six months before the games begin, the Team of Staff
produce a Program that lists the date, time and location of each sporting
event. At this point, Athletes can register for an event by giving their name,
address, date of birth and best time for their event. Some overseas athletes
need to apply for a visa and the system needs to record whether they were
successful.
A week before the games begin, a Team of Staff produce a Schedule that
shows when the registered athletes will participate in their event. At the
end of each event, the Team of Staff produce a Table of Results that
records the positions of each athlete.
Once all the events are completed, the Administrator checks the Table
of Results for accuracy and produces a Medals Table.
Draw a Class diagram for above mentioned scenario.