Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

having problem assigning a value to the member of a class  RSS feed

 
mike Vigor
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I'm having problem assigning a value to a member of a class in a composite way...
in class GoFt, i have the method createGoFTStructure, which creates an arraylist of type class Tn and assign it values  gotten from class makewheel...for a reason or so I'm not being able to set class Tn member npi, which I will like to, infact my only option is to do it in a composite way, I mean multiply some other stuff and assign it to the class member, which I'm doing but I'm getting output Float 0.0

I have a class Tn


and another class GoFT


another class makewheel

milan.txt which class makewheel uses to creates it's object contains data like so..

and class Row creates an object of type row which contains 5 members of type int like in milan.txt

when i do in main


I get the result

notice how the last float which should be member npi of object tn is always 0.0 ? why is npi not being assigned ?
 
Norm Radder
Ranch Foreman
Posts: 2240
28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try some debugging by adding a print statement after line 25 in the set method that prints out the value of npi, x and y
 
Henry Wong
author
Sheriff
Posts: 23284
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Possible Hint: What is the result of 1 (that is an integer) divided by 90 (that is also an integer)?
 
mike Vigor
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Henry Wong, I think you may have solved my problem, of course diving 1 by 90 as integers will leave us with zero ... infact I'm going to change that into a double, I don't even know why I'm using float instead of a double...thanks a lot...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!