What's the hidden test 5 in the project Robot-Barman in the C# course ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What's the hidden test 5 in the project Robot-Barman in the C# course ?

I am trying to compleye the barmen project but I cannot figure out what the test for nr 5 is. I managed to pass the others but not the last one https://code.sololearn.com/c7Jq9YQIA50x/?ref=app

15th Dec 2020, 3:09 AM
Yaye
Yaye - avatar
5 Answers
+ 4
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { try { int drinks = Convert.ToInt32(Console.ReadLine()); int shelves = Convert.ToInt32(Console.ReadLine()); int x = Convert.ToInt32 (drinks /shelves); //your code goes here Console.WriteLine(x); } /* * 1. DivideByZeroException => "At least 1 shelf" * 2. FormatException => "Please insert an integer" */ catch (DivideByZeroException) { Console.WriteLine("At least 1 shelf"); } catch (FormatException) { Console.WriteLine("Please insert an integer"); } } } }
7th Feb 2021, 4:56 PM
Md Momin Uddin Hridoy
Md Momin Uddin Hridoy - avatar
+ 2
I dont know C# but, This may help you. No one knows what the test case 5 is, as it is always hidden. Instead of asking for the hidden test case (which has no answer), the thing you should do is to adjust your code, or Send your attempt here so others may figure out what's wrong. Thanks. Happy Coding!
15th Dec 2020, 3:41 AM
noteve
noteve - avatar
+ 1
Ok thanks guys
15th Dec 2020, 6:17 AM
Yaye
Yaye - avatar
0
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SoloLearn { class Program { static void Main(string[] args) { try { int drinks = Convert.ToInt32(Console.ReadLine()); int shelves = Convert.ToInt32(Console.ReadLine()); Console.WriteLine(drinks /shelves); } catch (DivideByZeroException c) { Console.WriteLine("At least 1 shelf"); } catch (FormatException c2) { Console.WriteLine("Please insert an integer"); } } } }
23rd Feb 2021, 2:03 AM
Mohamed BOUANANE
Mohamed BOUANANE - avatar
0
I think it may be that you wrote "At least 1 shelve" instead of "At least 1 shelf"
8th Apr 2021, 3:41 PM
Mr._V1ct0r
Mr._V1ct0r - avatar