(Sp 07) In this question I ask you to write a class to implement an ADT for the kitchen timer that my wife uses. It has three counters. Each can be set to a given number of seconds. With each tick of the clock, each timer that has been set loses one second. When a timer hits zero, it stops. Write a class Timer that will compile and run when used in the program below, producing the indicated output. Except for detecting various errors, the class need only have sufficient functionality to produce the indicated output. You should provide both the class declaration and the definitions (code). int main(){ Timer a; a.set(2,24).set(3,30); cout< using namespace std; class Timer{ public: Timer(); Timer & set(int j,int t); Timer &tick(); void reset(int j); friend ostream & operator<<(ostream &out,const Timer &t); private: int times[3]; static void check(bool b, char *mess); }; Timer::Timer(){ for(int j=0;j<3;j++) times[j]=0; } Timer & Timer::set(int j, int t){ check(j>=1 && j<=3,"bad timer number"); check(t>=0,"need non-negative time"); times[j-1]=t; return *this; } Timer & Timer::tick(){ for(int j=0; j<3; j++) if(times[j]>0) times[j]--; return *this; } void Timer::reset(int j){ set(j,0); } ostream &operator<<(ostream &out,const Timer&t){ out<<"Timer["; for(int j=0;j<3;j++){ if(j>0) out<<","; out<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> (f06t1) 3. Consider the abstract data type (ADT) for a traffic light. It can be in one of three conditions, RED, YELLOW, and GREEN. Each time it "turns" it changes color, in the order GREEN, YELLOW, RED, GREEN,... Write a class to implement this ADT. The class need only have the functionality needed for the program below to produce the output indicated in the comments. To make the writing easier, I call the class TL (for Traffic Light). TL a, b(TL::RED), c(b); cout<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> #include using namespace std; class TL {public: static const int RED=2, YELLOW=1, GREEN=0; TL(int col=GREEN); TL(const TL &t); TL & turn(); friend ostream & operator<<(ostream &out,const TL &t); private: int lightColor; }; TL::TL(int col):lightColor(col) {if(colRED) col=GREEN} TL::TL(const TL &t):lightColor(t.lightColor){} TL & TL::turn() {lightColor=(lightColor+1)%3; return *this; } ostream & operator<<(ostream &out,const TL &t) {out<<"["; switch(t.lightColor) {case TL::GREEN: out<<"Green"; break; case TL::YELLOW: out<<"Yellow"; break; case TL::RED: out<<"Red"; break; } out<<"]"; return out; } <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< (F06T2) 1. Consider the abstract data type of an ordered pair and label the elements of the pair x and y. We should be able to create an ordered pair, get the entries in the pair, and print it out. Write the template for the OrdPair class so that the following code will compile and produce the indicated output. OrdPair a(7,3.2); cout< using namespace std; template class OrdPair {public: OrdPair(const A &a, const B &b); A getX()const; B getY()const; template friend ostream & operator<<(ostream &out,const OrdPair & op); private: A x; B y; }; template OrdPair::OrdPair(const A&a, const B&b):x(a), y(b){} template A OrdPair::getX()const{return x;} template B OrdPair::getY()const {return y;} template ostream & operator<<(ostream &out,const OrdPair & op) {out<<"("<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> (s06f) 4. Write the declaration and definition (code) for the class LUAcc which is meant to store information for LTS user accounts: the first name, the last name, and the user identifier. It should have sufficient functionality so that the code below produces the indicated output. Your class need only store the first 15 characters of a name, discarding the rest, and can assume all user identifiers have six or fewer characters. LUAcc x("Tom", "Mix", "TM203"); cout<=0 && var<=2,"Bad choice in set()"); switch(var) {case 0: copy(fname,c,15); break; case 1: copy(lname,c,15); break; case 2: copy(email,c,6); break; } } const char * LUAcc::get(int var)const {check(var>=0 && var<=2,"Bad choice in set()"); switch(var) {case 0: return fname; case 1: return lname; case 2: return email; } return ""; //keep the compiler happy } void LUAcc::check(bool b, char *mess) {if(!b) {cerr<<"ERROR: "<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>