0

Test 3 and 4 keep failing and the annoying part is that i cant see what those tests check in order to corect my code

https://www.sololearn.com/coach/22?ref=app

2nd Jan 2020, 3:13 PM
Giura Emanuel
Giura Emanuel - avatar
14 Antworten
+ 4
Giura Emanuel You need to round up. Try Math.Ceiling().
2nd Jan 2020, 5:40 PM
Denise Roßberg
Denise Roßberg - avatar
+ 4
Giura Emanuel It won't be a challenge if it would be possible to see all test cases.
2nd Jan 2020, 3:44 PM
Denise Roßberg
Denise Roßberg - avatar
+ 3
The idea is that you find a general solution and not just one that works for the few test cases.
2nd Jan 2020, 4:10 PM
Denise Roßberg
Denise Roßberg - avatar
+ 3
do you want to try posting your code? its not a waste of time just because you cant figure out how to do it. its a learning experience. also, im sure test cases are hidden because A.) you dont know what a user is going to input in real life situations, and most importantly, B.) they dont want you to hard code anything to get all of the answers right.
2nd Jan 2020, 5:26 PM
꧁༺ Jenspi ༻꧂
꧁༺ Jenspi ༻꧂ - avatar
+ 2
Thanks. That did the trick. I thought round would do but definitely i overlooked something.
2nd Jan 2020, 5:45 PM
Giura Emanuel
Giura Emanuel - avatar
+ 2
sometimes taking a break and coming back to the problem is the best solution! i think we all tend to read over important details and get frustrated when we’ve been coding for too long without breaks. it’s great that you’re asking for help!
2nd Jan 2020, 6:22 PM
꧁༺ Jenspi ༻꧂
꧁༺ Jenspi ༻꧂ - avatar
+ 2
Use Math.Ceiling method to get pass the test cases
3rd Jan 2020, 6:27 PM
Bishow Pandey
Bishow Pandey - avatar
+ 1
So all in all its a trial and error game în which you end up wasting too much for really simple things. Great.
2nd Jan 2020, 3:46 PM
Giura Emanuel
Giura Emanuel - avatar
+ 1
yep, Math.Round() only rounds it to the nearest whole number when the problem wants us to round to round up specifically :)
2nd Jan 2020, 5:45 PM
꧁༺ Jenspi ༻꧂
꧁༺ Jenspi ༻꧂ - avatar
+ 1
Yeah, its kinda difficult to code when your brain is tired. Its easy to miss important details. Also i should make a habit of asking for help more often when i get stuck because most of the time i struggle too much and its pointless when you get stuck to try figure it on your own because you just dont know how to solve your own problem and end up getting frustrated and losing way too much time. I know its part of the learning proces but our time should be spent smarter.
2nd Jan 2020, 5:55 PM
Giura Emanuel
Giura Emanuel - avatar
+ 1
Its just the fear that people will jump at you for asking silly questions justifying that you didnt bothered to research before asking while that being the case. It just happens to not know Even if its an easy question. Maybe you didnt know the keywords to google it right the first time or whatever else. Point is sometimes it really is hard to find help. At least that was my case for quite sometime. That doesnt mean i should stop asking for it if i need it just because. Just my two cents on the matter.
2nd Jan 2020, 6:32 PM
Giura Emanuel
Giura Emanuel - avatar
0
Anyone knows why some test cases are hidden? Its very annoying. I could correct my own code without having to post everytime i get stuck.
2nd Jan 2020, 3:38 PM
Giura Emanuel
Giura Emanuel - avatar
0
Sure why not. int numberOfColors = Convert.ToInt32(Console.ReadLine()); double canvasAndBrushesPrice = 40.00; double colorPrice = 5.00; double Cost = (numberOfColors * colorPrice) + canvasAndBrushesPrice; double tax = Cost * 0.1; double totalCost = Cost + tax; Console.WriteLine((int)Math.Round(totalCost)); Now only test 3 fails. I don't deny the fact that i mightve missed something but i cant figure out what exactly.
2nd Jan 2020, 5:35 PM
Giura Emanuel
Giura Emanuel - avatar