123456789101112131415161718192021222324252627282930313233343536 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Calculation
- {
- public class Calculator
- {
- public int Calc(decimal price, int count)
- {
- int sale = 0;
- if (count > 0 && price > 0)
- {
- if (count >= 3)
- {
- sale = 5;
- }
- if (count >= 5)
- {
- sale = 10;
- }
- if (count >= 10)
- {
- sale = 15;
- }
- if (price / 500 >= 1)
- {
- sale += Convert.ToInt32(Math.Floor(price / 500));
- }
- }
- return sale;
- }
- }
- }
|