GRP+5.2


 * GRP 5**


 * NAME: Fan Jun Wei (3S2-10)**
 * NAME: Kok Xuan Liang (3S2-13)**
 * NAME: Chow Guang Wei Stephen (3P3-04)**

code format="cpp-qt" /* Question: OOP Task 2 (Negate & Norm)
 * OOP Task 2 (Negate & Norm) >> Group Work**

Group: Group 5

~Member 1~ >>Name: Fan Jun Wei >>Class: 3S2 >>Index: 10

~Member 2~ >>Name: Kok Xuan Liang >>Class: 3S2 >>Index: 13

-Member 3- >>Name: Chow Guang Wei Stephen >>Class: 3P3 >>Index: 04

Date-Of-Submission: 26 June 2010

using namespace std;
 * 1) include
 * 2) include 

class PT { protected: int x;       int y;        int z;

public: PT{x=0; y=0; z=0;}; // Default Constructor

PT(int x2, int y2, int z2){x=x2; y=y2; z=z2;}; // Constructor ~PT{}; // Destructor

// Functions void PRINT{ cout<<"("<>x1>>y1>>z1; cout<> Fan Jun Wei [3S2-10]**

>>Name: Fan Jun Wei >>Class: 3S2 >>Index: 10

Date-Of-Submission: 29 July 2010



using namespace std;
 * 1) include
 * 2) include 

class TIME { protected: int h;       int m;        int s;

public: TIME{h=0; m=0; s=0;}; // Default Constructor

TIME(int h1, int m1, int s1){h=h1; m=m1; s=s1;}; // Constructor ~TIME{}; // Destructor

// Functions TIME Display{ //Display Hour if (h<10){ cout << "0" << h << ":"; }           else { cout << h <<":"; }

//Display Minute if (m<10){ cout << "0" << m << ":"; }           else { cout << m <<":"; }

//Display Seconds if (s<10){ cout << "0" << s;           } else { cout << s;           }

};

//increase time according to values defined by user TIME Advance(int h2, int m2, int s2){ s = s + s2; m = m + m2; h = h + h2;

//limiting seconds to max 59 if (s>59){ m = m + (s/60); s = s - (s/60)*60; }

//limiting mintues to max 59 if (m>59){ h = h + (m/60); m = m - (m/60)*60; }

//limiting hours to max 23 if (h>23){ h = h%24; }

};

//resets the time to 00:00:00 TIME Reset{ h = 00; m = 00; s = 00; };

};

int main { int in_h; int in_m; int in_s; int in_h2; int in_m2; int in_s2;

//Obtaining Time From User cout << "Please enter the time in hh mm ss format" << endl; cin >> in_h >> in_m >> in_s; cout << endl;

//Define Time TIME t1(in_h, in_m, in_s);

cout << "You've entered "; t1.Display; cout << " as the time." <> in_h2 >> in_m2 >> in_s2; cout << endl;

cout << "Time now is "; t1.Advance(in_h2, in_m2, in_s2); t1.Display; cout << endl << endl;

//Resetting Time cout << "Now resetting time..." << endl; t1.Reset; t1.Display; cout << endl;

cout<> Kok Xuan Liang (3S2-13)**

Name: Kok Xuan Liang Class: 3S2 Index: 13

Date-Of-Submission: 29 July 2010



using namespace std;
 * 1) include
 * 2) include 

class TIME { protected: int h;       int m;        int s;

public: TIME{h=0; m=0; s=0;}; // Default Constructor

TIME(int h1, int m1, int s1){h=h1; m=m1; s=s1;}; // Constructor ~TIME{}; // Destructor

// Functions TIME Display{

if (h<10) { cout<<"0"<59) {h=h+(m/60); m=m-(m/60)*60; }

if (s>59) {m=m+(s/60); s=s-(s/60)*60; }

if (h>23) {h = h%24; }

};

TIME Reset{ h=00; m=00; s=00; }; };

int main{ int inputh, inputm, inputs; int inputh2, inputm2, inputs2;

//Allowing user to enter current time cout << "Enter the current time in the format of hh mm ss with spaces included." << endl; cin >> inputh >> inputm >> inputs; cout << endl;

//Display current time TIME time1(inputh, inputm, inputs);

cout << "The current time you entered is "; time1.Display; cout<> inputh2 >> inputm2 >> inputs2; cout << endl;

cout << "The time advanced is "; time1.Advance(inputh2, inputm2, inputs2); time1.Display; cout << endl << endl;

//Reset time back to 00:00:00 cout << "The time has been resetted back to" << endl; time1.Reset; time1.Display; cout << endl;

cout<> Chow Guang Wei Stephen (3P3-04)**
 * // Done by: Stephen Chow 3P304

using namespace std;
 * 1) include

class Time{ protected: int hr, min, s;                { if (sec>=60){ min=min+(sec/60); sec=sec%60; }                     if (min>=60){ hour=hour+(min/60); min=min%60; }                     if (hour>=24){ hour=hour%24; }

}

public: Time{hr=12; min=0; s=0;}; //Default Constructor Time(int hr1, int min1, int s1) {hr=hr1; min=min1; s=s1;}; //Constructor ~Time{}; //Destructor

void Display{ if (hr>10)cout<< “The time is ” <10) cout<10) cout<<s; else cout<< "0"<<s; cout<< endl; }; //Display the time in h:m:s void Advance   { hr = hr+1; min = min+1; s = s+1; }; // Advance time

Time Reset(int hrb, int minb, int sb){ hr=hrb; min=minb; s=sb; tunetime; }// Reset time

}; // Time Class

int main{ system ("pause"); return 0; }**

code