C++ solved practical slips of S.Y.B.Sc. Computer Science
Title of Exp: Class, Object and methods implementation. Set A: (a)Write the definition for the class called 'time' that has hours, minutes & seconds as integer data members.The class has the following member functions. //ASSignment 9: //set A #include<iostream.h> //using namespace std; class clk { int hr,min,sec; public: void settime(int h,int m,int s) { hr=h; min=m; sec=s; } void showtime() { cout<<"\n\t Houre="<<hr<<endl; cout<<"\t Minutes="<<min<<endl; cout<<"\t seconds="<<sec<<endl; } void add(int h,int m,int s) { hr=hr+h; min=min+m; sec=sec+s; if(sec>60) { int rem=sec/60; int quo=sec%60; min=min+rem; sec=quo; if(min>60) { int rem=min/60; int quo=min%60; hr=hr+rem; min=quo; } } cout<<"\n\n After addition the time is:-"; cout<<"\n Hour:-...