Skip to content

Implemented getTotalPriceMessage() function - #161

Open
ddryzhov wants to merge 1 commit into
mate-academy:mainfrom
ddryzhov:buy-products
Open

Implemented getTotalPriceMessage() function#161
ddryzhov wants to merge 1 commit into
mate-academy:mainfrom
ddryzhov:buy-products

Conversation

@ddryzhov

Copy link
Copy Markdown

Implemented getTotalPriceMessage() function that return a message with the total cost that the client needs to pay.

…h the total cost that the client needs to pay.
Copilot AI review requested due to automatic review settings April 20, 2026 11:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Implements getTotalPriceMessage() to return a formatted message showing the client’s total payment based on price * quantity.

Changes:

  • Added string formatting logic to compute and include the total price in the returned message.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


fun getTotalPriceMessage(client: String, price: Int, quantity: Int): String {
return ""
return "$client has to pay $${quantity * price} per $quantity products"

Copilot AI Apr 20, 2026

Copy link

Choose a reason for hiding this comment

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

This string literal won’t compile in Kotlin: $$ isn’t a valid way to emit a dollar sign inside a string template (the $ must be escaped). Use an escaped dollar sign before the total (e.g., \$${quantity * price}) so the output matches the expected "$" format.

Suggested change
return "$client has to pay $${quantity * price} per $quantity products"
return "$client has to pay \$${quantity * price} per $quantity products"

Copilot uses AI. Check for mistakes.
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