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

Develop #5006

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

Develop #5006

wants to merge 2 commits into from

Conversation

DavidKuznets
Copy link

No description provided.

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! 🎉 The logic is solid, and it meets the task requirements effectively. Just a couple of minor suggestions: consider renaming BASEPRISE to BASEPRICE and SELL to something more descriptive like DISCOUNT_AMOUNT for better clarity. Keep up the excellent work! 😊

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

* @return {number}
*/
const LONG_TERM = 3;
const BASEPRISE = 40;

Choose a reason for hiding this comment

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

The variable name BASEPRISE seems to be a typo. It should likely be BASEPRICE to correctly represent the base price of the rental.

@@ -6,5 +1,22 @@
const LONG_TERM = 3;
const BASEPRISE = 40;
const SELL = 20;

Choose a reason for hiding this comment

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

The variable name SELL is not clear in this context. It might be intended to represent a discount or reduction, so a more descriptive name like DISCOUNT_AMOUNT would be more appropriate.

function calculateRentalCost(days) {
// write code here
const fullCost = days * BASEPRISE;

Choose a reason for hiding this comment

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

The calculation of fullCost is correct, but ensure that the variable BASEPRISE is correctly named as BASEPRICE.

const fullCost = days * BASEPRISE;

if (days >= GOOD_DAYS) {
return fullCost - DISCOUNT;

Choose a reason for hiding this comment

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

The logic here is correct for applying a discount for rentals longer than GOOD_DAYS. Ensure that the discount logic is clearly documented or explained.

}

if (days >= LONG_TERM) {
return fullCost - SELL;

Choose a reason for hiding this comment

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

The logic here applies a discount for rentals longer than LONG_TERM. Ensure that the variable SELL is correctly named to reflect its purpose as a discount.

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.

2 participants