-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Solution #5117
base: master
Are you sure you want to change the base?
Solution #5117
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job on implementing the calculateRentalCost
function! 🎉 The code meets the task requirements and constraints effectively. While there is a minor overlap in the discount conditions, it does not critically impact the functionality. Keep up the good work, and consider refining the discount logic to ensure clarity and prevent potential overlaps in the future. 😊
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
if (days >= 3 && days <= 6) { | ||
return BasePrice * days - ShortTermDiscount; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition days >= 3 && days <= 6
applies a short-term discount for rentals between 3 and 6 days. However, this logic overlaps with the long-term discount condition. Consider revising the conditions to ensure that only one discount is applied for each range of days.
if (days >= LongTerm) { | ||
return BasePrice * days - LongTermDiscount; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The condition days >= LongTerm
applies a long-term discount for rentals of 7 days or more. Ensure that this condition does not overlap with the short-term discount condition to avoid applying multiple discounts for the same rental period.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accepted, well done
No description provided.