J
Jazz
Alright I'm new to Java and I'm in the middle of doing my java project. I
have a super class called SFactory that has 2 protected Queues named q1 and
q2. I was asked to create a class called PlateFactory that will extend
SPlateFactory.
The Factory constructor:
public Factory(int n)
/* builds two identical queues containing n randomly-
generated plates. The variables q1 and q2 (inherited
from SPlateFactory) may be initialized and accessed
directly in this constructor. */
This is what I did:
public Factory(int n) {
for (int i = 0; i < n;i++){
Plate p = new Plate();
q1.enqueue(p);
q2.enqueue(p.getCopy());
}
}
This is fine except that I need to first actually create the
2 new queues (empty) that q1 and q2 will reference.
How do i do that?
Thanks
Jazz
have a super class called SFactory that has 2 protected Queues named q1 and
q2. I was asked to create a class called PlateFactory that will extend
SPlateFactory.
The Factory constructor:
public Factory(int n)
/* builds two identical queues containing n randomly-
generated plates. The variables q1 and q2 (inherited
from SPlateFactory) may be initialized and accessed
directly in this constructor. */
This is what I did:
public Factory(int n) {
for (int i = 0; i < n;i++){
Plate p = new Plate();
q1.enqueue(p);
q2.enqueue(p.getCopy());
}
}
This is fine except that I need to first actually create the
2 new queues (empty) that q1 and q2 will reference.
How do i do that?
Thanks
Jazz