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.

  1. A Series represents an integer number series such as a series of even numbers or a series of multiplies of 5 etc.
  2. One instance variable called start which represents the starting integer of the series.
  3. Methods:
    1. getNext - Abstract method that returns the next number in the series
    2. getPrev - Abstract method that returns the previous number in the series
    3. reset Abstract method that restarts the series by setting
    4. 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.
    5. getStart - returns the start value of the series ============================================================================
  4. Create a class By-Twos that is a subclass of the Series Class

  5. By-Twos is a series that increments by 2 such as 3,5,7 etc.
  6. Instance variables
    1. val - current value of the series
    2. preval - previous value of the series.
  7. Constructor
    1. one parameter representing the start of the series
    2. Sets instance variables start, val and preval to the appropriate value.
  8. Methods
    1. Accessor methods for val and preval.
    2. Methods required by inheritance, if any ==================================================================

Write class called ByTwosTester

  1. This class contains a main method that will test the ByTwos Class
  2. The class
    1. Loop thru an ByTwo Series 5 times
    2. 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!