Help guys pls (Solved) ( TNX) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Help guys pls (Solved) ( TNX)

The store is running a promotion: if the total value of purchases is equal to or more than 10,000, then the buyer is given a 20% discount. You are given a program that takes the total purchase price as input. Complete the method provided so that the program uses the total purchase amount as an argument, deducts and returns the discount price if the promotion requirements are met. If no discount is provided, the method should output the same price. Sample input 13000 Result example 10400 Explanation 13000> 10000, so the discount is given: 13000- (0.2 * 13000) = 10400. Advice Inside the method, use an if else statement Pls help me with the code, i dont understand why it's not working, explain, ty very very. https://code.sololearn.com/cd3HxfYp4sp6/?ref=app

28th Feb 2021, 8:23 PM
Nazik Sidorchuk
Nazik Sidorchuk - avatar
4 Answers
+ 4
There is another problem too. If you like you can check how can be it solved: https://code.sololearn.com/c1jL5IIWfZu5/?ref=app
28th Feb 2021, 8:52 PM
JaScript
JaScript - avatar
+ 2
You do not return any value, so int method cannot be used but void: static void Discount(int x){...}
28th Feb 2021, 8:32 PM
JaScript
JaScript - avatar
+ 1
Ty, i understand now my mistake
28th Feb 2021, 9:10 PM
Nazik Sidorchuk
Nazik Sidorchuk - avatar
+ 1
Очень хорошо если понимаетса как это работает.
28th Feb 2021, 10:17 PM
JaScript
JaScript - avatar