5 XP challenge

Calculate a Two-Tier Price

very easy
Build it yourself · 3 min
1 Learn2 Predict3 Solve

Task
Your mission

Return the total price of quantity units. The first allowance units each cost firstRate; later units each cost extraRate. All inputs are integers from 0 to 20.

Examples

InputReturn
quantity = 3, allowance = 5, firstRate = 2, extraRate = 46
quantity = 5, allowance = 5, firstRate = 2, extraRate = 410

Your code

Write your answer inside Solution, then use return to send it back.

Try examples runs the public examples. Check my code checks your full answer and saves your completion.