0

C# It’s a dirty code.How to do clear code?Why the test 4th fail?Это грязный код.Как сделать чистый код?Почему 4тест не проходит?

C# It’s a dirty code. How to do clear code? Why the test 4th fail?Это грязный код. Как сделать чистый код? Почему 4-ый тест не проходит? https://code.sololearn.com/cVlh76Y5zg6n/?ref=app

30th Oct 2020, 6:13 AM
Sergey
Sergey - avatar
6 Respostas
+ 2
You should read a guide about OOP, especially how to use properties. And also read about OO analysis and design. I think you wanted to do a class structure like for a shopping cart in online shopping but your classes don't reflect that very well. The values you set in constructor should all come from outside as parameters or via property setters. But regarding the challenge you don't need all that. A simple formula to calculate the output from the input would suffice. Regarding the failed test I think it is just a matter of rounding. Since you are rounding to the nearest decimal, which results in rounding up for odd inputs >1, try rounding down (Math.Round with MidpointRounding.ToZero)
30th Oct 2020, 1:11 PM
Benjamin Jürgens
Benjamin Jürgens - avatar
0
may be show me?)) and I check this code here
30th Oct 2020, 1:27 PM
Sergey
Sergey - avatar
0
only with OOP
30th Oct 2020, 1:27 PM
Sergey
Sergey - avatar
0
and say you fail or not fail
30th Oct 2020, 1:28 PM
Sergey
Sergey - avatar
0
without structure, clear OOP
30th Oct 2020, 1:29 PM
Sergey
Sergey - avatar
0
Product, Category, Order and etc))
30th Oct 2020, 1:51 PM
Sergey
Sergey - avatar