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
14 Antworten
+ 4
Giura Emanuel
You need to round up. Try Math.Ceiling().
+ 4
Giura Emanuel
It won't be a challenge if it would be possible to see all test cases.
+ 3
The idea is that you find a general solution and not just one that works for the few test cases.
+ 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.
+ 2
Thanks. That did the trick. I thought round would do but definitely i overlooked something.
+ 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!
+ 2
Use Math.Ceiling method to get pass the test cases
+ 1
So all in all its a trial and error game în which you end up wasting too much for really simple things. Great.
+ 1
yep, Math.Round() only rounds it to the nearest whole number when the problem wants us to round to round up specifically :)
+ 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.
+ 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.
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.
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.