Help for C# 25.2 SOLUTION (please help me | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

Help for C# 25.2 SOLUTION (please help me

A store is running a promotion: if the total purchase price is equal to or exceeds 10000, the price will be discounted by 20%. The program you are given takes the total purchase price as input. Complete the given method to take the total purchase price as an argument, and calculate and return the discounted price if campaign's requirement is satisfied. The method should return the same price if discount is not given. Sample Input 13000 Sample Output 10400 Explanation 13000>10000, so the discount should be given: 13000-(0.2*13000) = 10400. Hint You need to use if else statements inside the method. https://code.sololearn.com/cCVnAB8K8V1e/?ref=app

29th Sep 2021, 6:05 AM
Tim Tam
1 ответ
+ 4
//call the method Console.WriteLine(Discount(totalPrice)); } //complete the method declaration static int Discount(int price) { //complete the method body if(price > 10000){ return price - Convert.ToInt32(0.2 * price); }else{ return price; } }
29th Sep 2021, 6:20 AM
Erlénio.RS
Erlénio.RS - avatar