• 8
  • Locked
Create an application for a cat census. First, ask the user to enter cat names. Then the program should create Cat objects with the appropriate names and display the result of cat.toString().
You can't complete this task, because you're not signed in.
Comments (4)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Level 23 , Valladolid, Spain
30 September 2021, 09:03
@CodeGym the task only pass the test when the default branch is taken in the switch statement, I think it makes no sense. In fact, According to the switch statement we'd have to lowerCase the input, but it does not allow passing the test
Karas Java Developer
9 March 2021, 21:11
I think it is on purpose. When you get to this task what you are thinking is "how do I stop the loop?" Not really thinking on what the inputs or outputs will be. Later on you see easy ways to stop loops butfor now go ahead use the big G to look for the answer, keep learning, keep asking, add more tools to your belt. Skip those tasks hard to do, come back once you have a better answer and more tools, or like me, when you do not have enough dark matter hehehe.
Christ Desmedt
Level 19 , Gent
18 February 2021, 14:39
@CodeGym please fix this check, it makes no sense. The program only successfully meets the requirements when all names get the default cat variable (an alley cat). The input is capitalized on the first letter, the check happens with all lowercase.
Level 16 , Jacksonville, United States
18 March 2022, 19:10
It's infuriating but this was the problem with my code after it failed 3 times, but worked each time, and with each iteration. My problem was the same. I had added a toLower() on the input so it would then work with the switch they had created, since all switch keys were in lower and the inputs had one upper. I'm beyond annoyed that in making the code work you cannot pass the test.