I need help solving this Java problem, any advice, tips, or code would be greatly appreicated. Thanks.

Begin by writing an abstract class named Sequence. The Sequence class contains the following abstract methods:

public abstract boolean hasNext()
Returns true if the sequence contains another term after the current term. This is not a mutator.

public abstract Object next()
Returns the current term of the sequence and advances the sequence. This is a mutator.

public abstract Object peek()
Returns the current term of the sequence without advancing the sequence. This is not a mutator.

public abstract Object nth(int n)
Returns the nth term of the sequence or -1 if this term does not exist. Use 0 origin indexing. This is not a mutator.

public abstract void reset( )
Resets the current term back to the first term of the sequence. This is a mutator.

To complete this level you will now write three classes that extend the Sequence class(either directly or through a chain of intermediate classes – do what you want). We will check to make sure your three class definitions do rely on the Sequence class. Each of these classes should have a null constructor (a constructor that takes no arguments).

(1) PositiveIntegers enumerates all the positive integers starting with 1.

(2) EvenIntegers enumerates all the positive even integers starting with 2.

(3) AllPrimes enumerates all the prime numbers starting with 2.

(4) Add a second constructor to each of the above classes. This constructor takes a single argument of the same type as the class being defined, and makes a copy of that argument. Note: If the sequence in the argument has been advanced to the nth term, make sure the copy you create has been advanced to the nth term as well.

Hey, maybe if I knew what to do I would. But I'm glad that you wasted your time on the internet telling me to do my homework making you feel special. Really, thank you so much for all your help. Maybe if you didn't have your head up your ass you would learn that know one likes a sarcastic bastard. Good work jwenting.

Please only respond to this if you have something helpful or kind to post, I'm trying to learn how to write code, and not have people bash me for "not doing homework". Get real people, I am looking for a helping hand, that is all. Thank you.

all you post is the exact text of your assignment, which is a clear indication that you have no interest in doing anything at all yourself.
You're too lazy to even put in the usual "giv me ze coduz asap plz!!!".

This article has been dead for over six months. Start a new discussion instead.