Giter VIP home page Giter VIP logo

Comments (4)

thu-ngx avatar thu-ngx commented on May 26, 2024

@vhpx what is your suggestion?

from video-store-manager.

vhpx avatar vhpx commented on May 26, 2024

The rental status should be in Transaction and be named as isReturned. Being rented or not does not related to the stock whatsoever, but it is what we need to calculate the remaining stocks of any specific item.

For example:

int stocks = 30;

Transaction t1 = {..., true}
Transaction t2 = {..., false}
Transaction t3 = {..., true}

// For loop to increment by 1 when isReturned is true and decrement by 1 when it is false

// Result is 29 items in stock because 1 transaction isn't resolved yet.

To check if the item still has stocks to be rented, create hasStock() in Item.

from video-store-manager.

thu-ngx avatar thu-ngx commented on May 26, 2024

Thank you for your suggestion. I'll delete the attribute rentalStatus.

For the method hasStock() , we aleady have the method isEmpty() which has the same purpose.

In terms of the for loop, I think we need to update the stock whenever a transaction is made, not by looping through all transactions.

from video-store-manager.

vhpx avatar vhpx commented on May 26, 2024

Yup, that sounds great to me. I'll check back once you push your code.

from video-store-manager.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.