Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

implement a counter to count the number of employee records  RSS feed

 
Daniel Jenkins
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone help me put in a counter for the below code so i know how many records there are?
 
Norm Radder
Ranch Foreman
Posts: 2240
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
counter for the below code so i know how many records there are? 

One way would be to define an int field at the instance level and then add one to it as the records are accessed.

I'm confused why you are having a problem with this. I'd expect that someone that has written code with over 340 lines would know how to do it.
 
Campbell Ritchie
Marshal
Posts: 55751
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It shou‍ld be very easy to write:-It might even be easy to write it with private spelt correctly The hard part is deciding which object shoul‍d have that as a field and where to put the increment (where a new Employee object is created?)
 
Norm Radder
Ranch Foreman
Posts: 2240
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the totalEmployees variable for?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!