Cat register

  • 2
  • Locked
Sometimes an acute shortage of cats is felt more keenly than hunger. To combat this unpleasant feeling, you need to implement the addNewCat method, which will add a new cat to your program each time it is called. Use it carefully. More cats means more responsibility. Don't forget to increase the counter by one each time a cat is created.
You can't complete this task, because you're not signed in.
Comments (8)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Jorden R Hockings
Level 4 , Regina, Canada
8 February 2020, 20:37
this works but i am still getting a fail on the last requirement. do not know why can you please help????
KevinTing
Level 7 , Taipei, Taiwan, Province of China
5 December 2018, 05:26
please advise why this addNewCat() method has to be declared as "static", as I have tried many times with no static, which is always fail to increase cat number by 1. public static void addNewCat() { catCount = catCount + 1; }
Liew
Level 10
16 April 2020, 03:58
might be because it is not taking in any parameters? not really sure.
Md Sait
Level 4 , Hyderabad, India
10 November 2018, 12:06
please help catCount=catCount++ is not working i had to write catCount=catCount+1; or catCount++; to get passed can somebody please help me to understand why it is happening?
Austin
Level 6 , Lansing, United States
29 April 2019, 18:25
++catCount increments the value and immediately returns it. catCount++ also increments the value but returns the unchanged value of the variable.
GarBer
Level 6 , Anchorage, United States
22 May 2019, 14:14
catcount += 1 works
imran khan
Level 6 , islamabad, Pakistan
23 September 2018, 07:22
whats wrong with the code can anyone help plz plz help me out with this code
Roman
Level 41
24 September 2018, 05:29
If you need help, something isn't right in your code, the server won't accept your solution (even if you are 100% sure that it is correct). Describe your question/issue in the HELP section at codegym.cc/help.