sortJAVA

Given the following code
interface WritingTool
{
public double getWordsLeft(int newWords);
}
you are required to create two classes.First, write the code for an abstract class named Pen that implements the WritingTool interface.
Pen should have an integer attribute called wordLimit which represents the number of words that can be written during the life of a Pen. The default value for wordLimit is one million.Next, create a concrete class that is derived from Pen called BallPointPen.
BallPointPen has an integer attribute called futureWords that represents the number of words that can be written by the pen in the future. For a BallPointPen, calling getWordsLeft will result in the futureWords being incremented by newWords, and the returned value will be the difference between the wordLimit and the updated value of futureWords.All attributes should be private in all classes.
Accessors and mutators for all attributes should be provided.
The constructor of each class should initialize it’s attributes.

×
New Download