Download object oriented programming and more Essays (university) Object Oriented Programming in PDF only on Docsity! Bahria University, Lahore Campus Department of Computer Science Lab Journal 04 (Spring 2020) Course: Object Oriented Programming - Lab Date: _______________ Course Code: CSL-210 Max Marks: 10 Faculty’s Name: Ms. Zupash Awais Name: _____________________ Enroll No: ___________________ Class: ______________ Objective(s): Upon completion of this lab session, learners will be able to: Array of Objects Const Members Lab Tasks: Task 1 Create a class called time that has separate int member data for hours, minutes, and seconds. One constructor should initialize this data to 0, and another should initialize it to fixed values. Another member function should display it, in 11:59:59 format. #include<iostream> using namespace std; class time { int hour; int min; int second; public: time() :hour(0), min(0), second(0) { } time(int a, int b, int c) { hour = a; min = b; second = c; if (hour <= 0 || hour >= 23) hour = 0; if (min <= 0 || min >= 59) min = 0; if (second <= 0|| second >= 59) second = 0; } void display() { cout << hour << ":" << min << ":" << second << endl; % Enrollment Number: ____________________________ } }; void main() { time t(30, 9, 7); t.display(); } Task 2 Write a program with a class that contains following data members Id name marks Create and array of objects of size 10. Create a function read() to take input from user. Create a function to calculate percentage of each student. Then create a function that displays the student id and name of the student with the lowest percentage. #include<iostream> #include<string> using namespace std; class student { int marks; int id; string name; public: student(); void read(); }; student::student() { marks = 0; id = 0; name = " "; } student::student() { marks = 0; id = 0; name = " "; } void student::read() { } void main() { student p[10]; Page 2 of 4