• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem setting console input to methods in another class

 
Claire Skinner
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have the following part of a class. In the method writeToFile I am trying to set the data entered from the keyboard to another class holding the set methods for the data. I am then trying to call the calculate method from another class which uses the int nNumberOfDays and double fFineRate to calculate another double totalFine. Then I am trying to write all the data including totalFine back to the file.

I am getting an error message on both f.setNameOfPatron and f.setTitleOfBook saying that niether type can be set in this way.

I realise that my calling of set methods is wrong as the calculations are not taking place, but I can find no information on how to set the methods in this situation.

I am new at java and I am going round in circles trying to figure this out. If anyone can explain what I'm doing wrong, or point me to a tutorial link that might show me how to do this, that would be great.

Thanks in advance and sorry about the long code, but I'm unsure which part applies to where I've gone wrong.


 
Joe Ess
Bartender
Posts: 9362
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You didn't give us the code for the fines object, but you are attempting to pass setNameOfPatron and setTitleOfBook an array of bytes. What type of argument do those methods take?
 
Claire Skinner
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Joe

Sorry for that, I've attached my fines class to this post. They are a String type in my fines class. I'm trying to pass the strings, the int and the double to the methods in the fines class. Do I need to convert the byte to a string in the patronData class? How would I do this? or do you know of a tutorial that would show me how?

Thanks

 
Claire Skinner
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just a further note. The part of all this that I can't seem to work out is how to pass the data that is input from the console to the set methods of the fines class.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!