Git Product home page Git Product logo

Comments (8)

vhpx avatar vhpx commented on June 19, 2024 2

For most of the requirements, I think a simple canRent(item) would do the trick.

As for account promotions, let's have AccountManager manage the process.

public void levelUp(Account account) {
    if (account.role == "VIP") return;

   int resolvedTransactions = transactionManager.getTransactions(account, true);

    if (account.role == "REGULAR" && resolvedTransactions >= 5) {
        account.setRole("VIP");
        return;
    }

    if (account.role == "GUEST" && resolvedTransactions >= 3) {
        account.setRole("REGULAR");
        return;
    }

for the transactionManager.getTransactions() method, you can assume it's like this:

public ArrayList<Transaction> getTransactions(Account account);
public ArrayList<Transaction> getTransactions(Account account, boolean resolved);

from video-store-manager.

vhpx avatar vhpx commented on June 19, 2024 1

That could work. Design it the way it make sense to you and I'll take a look.

from video-store-manager.

HPOKSG avatar HPOKSG commented on June 19, 2024

For the first question, I think for every account, we gotta have an list where we track what items that the account itself
currently borrowing. I know it violated the encapsulation rule that I discussed with Phuc before, but it could be the way.

from video-store-manager.

vhpx avatar vhpx commented on June 19, 2024

I'm having lunch right now, I'll check back and reply later.

from video-store-manager.

thu-ngx avatar thu-ngx commented on June 19, 2024

Oh I misunderstood "at a time" sr. For that, we currently have a list for currentRentals, and the size of that list must be <= 2 for guest account. I thought it was "not to rent 2 items literally at 1 specific time".

from video-store-manager.

thu-ngx avatar thu-ngx commented on June 19, 2024

@vhpx What do you think?

from video-store-manager.

vhpx avatar vhpx commented on June 19, 2024

About the VIP account with the points system. Add the int points attribute ONLY to VIPAccount. Then override the rent() method inside it with point-related expressions, which should be straightforward from this point.

from video-store-manager.

thu-ngx avatar thu-ngx commented on June 19, 2024

@vhpx How would accounts pay for their rentals? Should we add another attribute which will be deducted when renting and increase when returning?

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.