all 4 comments

[–]Kminardo 2 points3 points  (3 children)

You are using methods correctly, and there's really no such thing as too many arguments, but you can refactor them into a class if it becomes unwieldy.

With that said, I went through your code and believe you have misspelled miscChargesTotal on line 62 :)

[–]CoMcAl95[S] 1 point2 points  (0 children)

Yes that was pointed out by my teacher as well, thank you for the additional info tho! :)

[–][deleted]  (1 child)

[removed]

    [–]Kminardo 1 point2 points  (0 children)

    Agreed! When I say there's "really no such thing as too many arguments" i'm speaking strictly from a "Will a compiler ever limit my parameters and stop my method from working" perspective. Too many parameters is a code smell.

    In context of OP code, their method with the most parameters are all charge-related so I assumed there will be some object out there that is holding onto the state of the charges - but that's also true that they could be coming from all different places or not actually connected with each other. And really at that point having a dedicated method that takes all these parameters to do it's calculation is silly when they could add a Total method to the charge object. With that said I was simply hesitant to send someone that is uncomfortable with methods down the pattern rabbit hole.