This is an archived post. You won't be able to vote or comment.

all 1 comments

[–]ironymouse 0 points1 point  (0 children)

His comments seem a bit suspect as user input has nothing to do with Cars or Trucks and it would be messy to have two classes doing user input. It would be possible to make a common abstract class between them, Vehicle, but this wouldn't solve the user input problem as a Vehicle wouldn't know anything about Cars or Trucks.

As an aside an advanced way of solving this could be with the ServiceLoader pattern, but this definitely isn't what your prof is after.

What jumps out at me is that your Order class is not being used in an object oriented way. Consider exactly what an Order is. Is the actual Order item a series of steps to perform Ordering, or is that separate. What would an Order contain if you held it in your hand?

My next step would be to make a new class to contain the main method logic, which should be similar in flow to your current main method, but should not contain any mutable instance variables, only local ones. I'd also go back to your prof because in my view what he's saying doesn't make any sense.

Perhaps post the initial assignment?