Question: Java: Please help with the following coding assignment.Thanks. ===================================== Write an Abstract class called Series. A Series represents an integer number series such as a
Java: Please help with the following coding assignment.Thanks.
=====================================
Write an Abstract class called Series.
- A Series represents an integer number series such as a series of even numbers or a series of multiplies of 5 etc.
- One instance variable called start which represents the starting integer of the series.
- Methods:
- getNext - Abstract method that returns the next number in the series
- getPrev - Abstract method that returns the previous number in the series
- reset Abstract method that restarts the series by setting
- setStart sets the start value of the series based on an integer parameter, for example if the parameter value is 6, the series would start at 6.
- getStart - returns the start value of the series ============================================================================
-
Create a class By-Twos that is a subclass of the Series Class
- By-Twos is a series that increments by 2 such as 3,5,7 etc.
- Instance variables
- val - current value of the series
- preval - previous value of the series.
- Constructor
- one parameter representing the start of the series
- Sets instance variables start, val and preval to the appropriate value.
- Methods
- Accessor methods for val and preval.
- Methods required by inheritance, if any ==================================================================
Write class called ByTwosTester
- This class contains a main method that will test the ByTwos Class
- The class
- Loop thru an ByTwo Series 5 times
- Produces the following output
Prev is 1 Next is 3 _______ Prev is 3 Next is 5 _______ Prev is 5 Next is 7 _______ Prev is 7 Next is 9 _______ Prev is 9 Next is 11 _______
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
