phone numbers using classes?
Can anyone point me to a simple phone number program using classes that i can learn from? Any examples are welcome.
This is what i am trying to accomplish.
A phone number consists of four separate pieces of information: an area code, an exchange, a local number, and a long-distance indicator (true or false). Design and build a PhoneNumber class that models a phone number, providing operations to construct, input, output extract each of the data members of a PhoneNumber object, and indicate whether or not the number is long-distance. The input operation should read a local or long-distance number and set the long-distance indicator accordingly. The output operation should display a local number differently from the way it displays a long-distance number (e.g., 555-1234 vs. (616) 555-1234).
Thanks!!
:D
Can anyone point me to a simple phone number program using classes that i can learn f
Thanks for the input but I need something like so
class PhoneNo
public:
//blah
private:
//blah
to this effect so i can learn from...
Can you help me?
p.s. here is some code i have tinkered with but still clueless...
Code:
class PhoneNumber
{
public:
// have a clue
private:
int myLocalNumber; //"555-5555"
int myLongDistance; //"813-555-5555"
int myAreaCode; //"813"
int myLocalExchange; //
};
i am clueless on where to put the code, how to run it so it would work. I think i would place it in a file like so...PhoneNo.h. Yes or no?
Can someone shed some light for me?