hello everyone, i am a java student and got stuck on a question. can someone help me UNDERSTANDING and SOLVING the question. your help will be greatly appreciated.help me understand the question,i do not want codes. NO STUPID ANSWER please
Question 1
Applying the object-oriented concepts of encapsulation and inheritance, implement a
super class called MyCounter with an integer instance variable called value. The class
has a default constructor and a user-defined constructor. Its public interface has one
permissible operation called accessValue() which allows return of its instance variable.
Implement 2 subclasses of MyCounter called CountUp and CountDn. The CountUp
class with its derived constructors defines an increment counter that provides the
increment privilege called increment(). The CountDn class defines a decrement counter
that provides the decrement privilege called decrement().
Implement a class called TestMyCounter which will simulate the 2 instances of subclass
as follow:
(i). To increment an object of CountUp (with initialize value 11) by 100 times and
display the final value of its instance variable.
(ii). To decrement an object of CountDn (with initialize value 22) by 19 times and display
the final value of its instance variable.
abstract classes
Page 1 of 14 Replies - 316 Views - Last Post: 09 October 2011 - 02:41 PM
Replies To: abstract classes
#3
Re: abstract classes
Posted 09 October 2011 - 02:36 PM
We have two tutorials on abstract classes and interfaces you may find helpful:
http://www.dreaminco...1&#entry1378692
http://www.dreaminco...implementation/
http://www.dreaminco...1&#entry1378692
http://www.dreaminco...implementation/
#4
Re: abstract classes
Posted 09 October 2011 - 02:38 PM
Quote
The class
has a default constructor and a user-defined constructor
has a default constructor and a user-defined constructor
what will the names,they cannot have the same name
#5
Re: abstract classes
Posted 09 October 2011 - 02:41 PM
Actually, they do have the same name. Additional constructors work the same as overloading methods- they just have different parameter lists.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote







|