Skip to content
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 #5245

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Solution #5245

wants to merge 3 commits into from

Conversation

OksanaKuziv
Copy link

No description provided.

@@ -4,7 +4,23 @@
* @return {number}
*/
function calculateRentalCost(days) {
// write code here
const dailyRate = 40;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For const variables it is better to use this name format 'DAILY_RATE'

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a 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! 🎉 Your code is well-structured, with clear variable names and a good use of constants. While the discount logic might need a review to ensure it aligns with the intended business rules, the core functionality is solid. Keep up the good work, and consider revisiting the discount application order to make sure it meets the requirements. Happy coding! 😊

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

Comment on lines +15 to +21
if (days >= longTerm) {
return rentAmount - longTermDiscount;
}

if (days >= shortTerm) {
return rentAmount - shortTermDiscount;
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic for applying discounts might be incorrect. Currently, if days is greater than or equal to longTerm, the function will apply the long-term discount and return immediately, without checking if the short-term discount should also be applied. Ensure that the discount logic aligns with the intended business rules. If both discounts should not be applied simultaneously, consider revising the conditions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants