What should my code be like (computer science/Intellij IDEA)?

Hello, I'm unfortunately stuck on these two tasks. What should my code look like? No matter what I try, I don't get any points 🙁

1 vote, average: 1.00 out of 1 (1 rating, 1 votes, rated)
You need to be a registered member to rate this.
Loading...
Subscribe
Notify of
2 Answers
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
daCypher
2 years ago

Without knowing what the parent class looks like from which IntegerFactory and DoubleFactory are derived, some of the code is just a guess. But it should look something like this:

 public class IntegerFactory extends NumberFactory { int current; int step; public IntegerFactory(int start, int step) { this.current = start; this.step = step; } @Override public int create() { int temp = current; current += step; return temp; } }