I think you have been given an over‑specified assignment, something I don't like. It deprives you of the opportunity to design the app, and may even allow the teacher to introduce errors into your work,
Jay Rex wrote:. . . The requirement given to me, includes the quantity inside the Product class.
Well done realising that
I know it makes no sense.
Good idea, but it is usually impossible to change an assignment after it has been issued.
I will clarify that point, as I am being asked to create a solution with a broken requirement.
Don't know. What if you have sell() and buyIntoStock() methods or similar? You would of course need a getNumberInstock() or similar method.
For argument's sake, is my idea of an overloaded update method way off the mark here, or would you simply use setters? Is that the right tool for this job? . .
Jay Rex wrote:For argument's sake, is my idea of an overloaded update method way off the mark here, or would you simply use setters? Is that the right tool for this job?
That is of course the book I am going to win here, so I can have two copies Go to that forum and thwart my evil plan by winning a copy yourself.
Daniel Demesmaecker wrote:. . . you should be able to update a single property so I would provide getters and setters. . . .
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your databasehttps://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database