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
7 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");
}
}
}
}
+ 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!
+ 1
Ok thanks guys
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");
}
}
}
}
0
I think it may be that you wrote "At least 1 shelve" instead of "At least 1 shelf"