GRP4.2

code Feedback A few points to note to the group: 1) For default constructor, 3 integers will be sufficient and initialized them to 0 2) Negate function no return needed, simply negate attributes directly 3) Norm function no return needed, calculate the dist base on its curr coordinates  therefore no need to take in a point code NAME: KELOYSIUS NAME: ALDRIC
 * GRP 4**

TASK 1 code using namespace std;
 * 1) include
 * 2) include 
 * 3) include 

class PT { protected : int x,y,z, xcordinate, ycordinate, zcordinate;

public : PT(int x=0, int y=0, int z=0){xcordinate = x; ycordinate = y; zcordinate = z;}; ~PT{ }; void setx(int xinput) { xcordinate = xinput; }; void sety(int yinput) { ycordinate = yinput; }; void setz(int zinput) { zcordinate = zinput; }; PT NEGATE(PT POINT) { POINT.setx(POINT.xcordinate*-1); POINT.sety(POINT.ycordinate*-1); POINT.setz(POINT.zcordinate*-1); cout << "(" << POINT.xcordinate << ", "<< POINT.ycordinate << ", "           << POINT.zcordinate << ")" << endl; }       PT NORM(PT POINT) { float sqrt((POINT.xcordinate*POINT.xcordinate)+(POINT.ycordinate*POINT.ycordinate)               +(POINT.zcordinate*POINT.zcordinate)); cout << sqrt;} } int main { int inputx, inputy, inputz; PT A;   cout << "Input x-coordinate : "<> inputx; A.setx(inputx); cout << "Input y-coordinate : "<> inputy; A.sety(inputy); cout << "Input z-coordinate : "<> inputz; A.setz(inputz); A.NEGATE(A); A.NORM(A); system("pause"); return 1; }

code TASK 2 - Aldric Bek

code /*Question: Mission 2 Time Class Implementation Name: Aldric Bek Zhen Feng Class: 3I3 Index no.: 01 using namespace std;
 * 1) include
 * 1) include

class TIME{

protected: int hrs, min, sec;

public: TIME{hrs = 00; min = 00; sec = 00;}; //Default Constructor void Set_h(int lllh){hrs = lllh;}; void Set_m(int lllm){min = lllm;}; void Set_s(int llls){sec = llls;}; ~TIME{}; //Destructor void Display{ if (hrs < 10){ //this makes the time display nicer cout << "0" << hrs << ":"; }                 else if (hrs > 9){ cout << hrs << ":"; }                 if (min < 10){ cout << "0" << min << ":"; }                 else if (min > 9){ cout << min << ":"; }                 if (sec < 10){ cout << "0" << sec << "." << endl; }                 else if (sec > 9){ cout << sec << "." << endl; }            };             TIME Reset{//function for reset hrs = 0; min = 0; sec = 0; }            TIME Advance(int h, int m, int s){ sec = sec + s;                 if (sec > 59) {min = min + sec/60; sec = sec - (sec/60)*60;}; min = min + m;                 if (min > 59) {hrs = hrs + min/60; min = min - (min/60)*60;}; hrs = hrs + h;                 if (hrs > 23) {hrs = hrs - 24;}; } };

int main { int inputh, inputm, inputs; TIME time; do {cout << "Enter current time in the following format - hours [enter], minutes[enter], seconds[enter] (24 hours time): " << endl; //getting current time cin >> inputh >> inputm >> inputs; } while (inputh > 24 || inputm > 60 || inputs > 60);//making sure time is within the 24 hours range time.Set_h(inputh); time.Set_m(inputm); time.Set_s(inputs); cout << "The current time is: "; time.Display; cout << "Advance the time if you wish. Enter the value in the following order - hours [enter], minutes[enter], seconds[enter]: "<< endl; cin >> inputh >> inputm >> inputs; time.Advance(inputh, inputm, inputs); cout << "The new time now is: "; time.Display; cout << "Reseting time." << endl; time.Reset; time.Display; system ("pause"); return 1; }

code

TASK 2 - Keloysius Mak

code /*Question: Mission 2 Time Class Implementation Name: Mak Zhi Hao Keloysius Class: 3I3 Index no.: 17 using namespace std;
 * 1) include
 * 2) include
 * 1) include

class TIME {     protected : int h, m, s, hstore, mstore, sstore;

public : TIME{int h = 0; int m = 0; int s = 0; int hstore = 0; int mstore = 0; int sstore = 0;} ; ~TIME{ }; void set(int hour, int min, int sec) { h = hour; m = min; s = sec; }; void secure(int hour, int min, int sec) { hstore = hour; mstore = min; sstore = sec; }; void Reset {                 h = hstore; m = mstore; s = sstore; }            void Advance(int hour, int min, int sec) {              h = (h + hour)%24; m = (m + min)%60; s = (s + sec)%60; set(h,m,s); }            void Display {                    cout << "Therefore it is " << (h%24) << ": "; if (m%60 < 10) {                    cout << "0" << (m%60) << ": "; }                    else {                    cout << (m%60) << ": "; }

if (s%60 < 10) {                    cout << "0" << (s%60) << " now on the 24-hour clock."<> hin; cout << "The minute ?: "<> min; cout << "And the second ?: "<> sin;

thist.set(hin, min, sin); thist.secure(hin, min, sin); thist.Display;

//begin loop while (proceed == 0) {                     cout<< "-"<>type; cout<< "-"<> hin; cout << "How many minutes ?: "<> min; cout << "How many seconds ?: "<> sin; thist.Advance(hin, min, sin); thist.Display; }

//reset if (type == 2) {            thist.Reset; thist.Display; }

//end if (type == 3) {            system("pause"); return 1; }   } }

code