>Thanks for all the help.... you guys cleared a few things up a but
>for me.... but here is my real challenge and I'm in a bit of a jam
>with it....
>
>I have to design an ADT for a modulo counter. a modulo counter is a
>counter that can cout up. when counting up, if the counter reaches
>its maimum value, the counter wraps back around to zero, it wraps
>around to the maximum value. Give the class declaration for my ADT.
Not sure you're asking the right question, but here's the answer to what
I think you're asking which is "Design an ADT suitable for constructing
counters, specifically a modulo counter:
You need an ADT for a counter. You then create a CDT for a modulo
counter.
class counter{
// stuff common to all counters. e.g.
// private member variable to store the current count.
// public member function to display the current count.
// public member function to get the current count.
// protected member function to set the current count.
// this will be called by the CDT's
}; // ADT
class modulo_counter : public counter{
// stuff specific to modulo
// public member function to increment counter.
// this will reset the counter to 0 if it reaches the limit
// inherits get and print from ADT (or implements own)
}; // CDT
The ADT will allow other sorts of counters:
class updowncounter : public counter{
// specifics
// public function to increment
// public function to decrement
// inherits/overrides get/display from ADT
};
class xxxcounter : public counter{
// spec
// public function to increment by x
// public function to decrement by y
.. etc.
};
>I'm not asking for anyone to do it for me... I'm just in a bit of a
>jam over it.... I've read the chapter on ADT's and such... again and
>again... still don't really get it.... I hate that text book....
>
>Thanks again for all your help :)
Any use?
--
PJH
"The difference between genius and stupidity is that genius had its
limits."
- Albert Einstein
Alderley plc, Arnolds Field Estate, The Downs, Wickwar, Gloucestershire, GL12 8JD, UK
Tel: +44(0)1454 294556 Fax: +44 (0)1454 299272
Website : www.alderley.com Sales : [EMAIL PROTECTED] Service : [EMAIL PROTECTED]
This email and its contents are confidential and are solely for the use of the intended recipient. If you are not the original recipient you have received it in error and any use, dissemination, forwarding, printing or copying of this email is strictly prohibited. Should you receive this email in error please immediately notify [EMAIL PROTECTED]
This email has been scanned for viruses, however you should always scan emails with your own systems prior to opening.
To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.
| Yahoo! Groups Sponsor | |
|
|
Yahoo! Groups Links
- To visit your group on the web, go to:
http://groups.yahoo.com/group/c-prog/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
