https://docs.google.com/viewer?a=v&pid=explorer&chrome=true&srcid=0B3GcG6SeWKK_YzE1NDNmY2MtNTY0Ny00NTVhLTg1M2EtNDc5YzRmOGEzMjA0&hl=en_US

I am completely stuck on this assignment I'm not sure what I should be getting. Can anybody take a look at my code and please help me. I need to complete this assignment asap. thanks

Direction: Design, implement, and test a class that represents a phone number. The number should be represented by a country code, an area code, a number, and a type. The first three values can be integers. The type member is an enumeration of HOME, OFFICE, FAX, CELL, and PAGER. The class should provide a default constructor that sets all of the values to zero and type to HOME. A constructor that enables all of the values to be set should be provided as well. You should also provide a constructor that takes just the number and type as arguments, and sets the country and area codes to those of your location. The class will have observers that enable each data member to be retrieved, and transformers that allow each data member to be changed. An additional observer should be provided that compares two phone numbers for equality.

https://docs.google.com/viewer?a=v&pid=explorer&chrome=true&srcid=0B3GcG6SeWKK_YzE1NDNmY2MtNTY0Ny00NTVhLTg1M2EtNDc5YzRmOGEzMjA0&hl=en_US

I am completely stuck on this assignment I'm not sure what I should be getting. Can anybody take a look at my code and please help me. I need to complete this assignment asap. thanks

Direction: Design, implement, and test a class that represents a phone number. The number should be represented by a country code, an area code, a number, and a type. The first three values can be integers. The type member is an enumeration of HOME, OFFICE, FAX, CELL, and PAGER. The class should provide a default constructor that sets all of the values to zero and type to HOME. A constructor that enables all of the values to be set should be provided as well. You should also provide a constructor that takes just the number and type as arguments, and sets the country and area codes to those of your location. The class will have observers that enable each data member to be retrieved, and transformers that allow each data member to be changed. An additional observer should be provided that compares two phone numbers for equality.

post your codes here!
AFAICS, all these should be class attributes and only you need getters and setters. Call those setter for attributes in question on constructor.

Your class should be something like this:

class phone
{
    public:
        // The type member is an enumeration of HOME, OFFICE, FAX, CELL, and PAGER
        enum phone_type_t = { HOME, OFFICE, FAX, CELL, PAGER } ; // *** added

        phone();
        //phone(int coCode, int arCode, int phNumber); // optional

        // A constructor that enables all of the values to be set should be provided as well.
        phone(int coCode, int arCode, int phNumber, phone_type_t phone_type ) ; // *** added

        // constructor that takes just the number and type as arguments, and sets the country and area codes to those of your location
        phone( int phNumber, phone_type_t phone_type ) ; // added

        int GetcoCode() const; //observer
        int GetarCode() const; //observer
        int GetphNumber() const; //observer
        // TODO: add observer for phone type

        // transformers that allow each data member to be changed
        void SetcoCode( int coCode ) ; // added
        // TODO: add other transformers.

        // Shouldn't comparison for equivalence should return a bool?
        /*Contact*/ bool /*ComparedTo*/ Equals( const phone& otherphone ) const ; // make const-correct

    private:
        int countryCode;
        int areaCode;
        int phoneNumber;

        phone_type_t type ; // *** added
};
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.