Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

logic check please

 
Tim Batts
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Brand spankin new rookie here. Entered the following test class and my output is incorrect. e2.count is supposed to end at 10 but I get 24 when I execute it. I've desk-checked 3 times and I get the 10 I'm supposed to, but output is still 24. Any ideas?

 
Tim Batts
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry about the indent format... the indent was there when I pasted the code to the forum, but disappeared when I submitted my post
 
Paul Clapham
Sheriff
Pie
Posts: 20764
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Evidently you didn't notice the "Code" button above the box you posted in. Try it again: first click the Code button, then paste your code between the tags which it generates.
 
Tim Batts
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:Evidently you didn't notice the "Code" button above the box you posted in. Try it again: first click the Code button, then paste your code between the tags which it generates.


Thanks... I'm new to the forum scene as well
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Without the code we'd be guessing.
 
Tim Batts
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found it:

Echo e2=e1;

should be

Echo e2=new Echo();

to create a new instance rather than duplicate the original count
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glad you got it working--but still post all the relevant code next time... Thanks :)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic