Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 197
  • Last Modified:

I need a progran that write numbers to a file and the same program should read the numbers from the file and perform caluclations

please send me code or ideas on how to do this .

program to read from and write to file and perofrm caluclations and display on the screen
0
swaroopanl
Asked:
swaroopanl
  • 4
  • 3
1 Solution
 
swaroopanlAuthor Commented:
thanks in advance
0
 
aozarovCommented:
1. reading text from file: http://javaalmanac.com/egs/java.io/ReadLinesFromFile.html
2. The sample code reads text. to convert text to number (as long as it is really a number) you can do Integer.parseInt(<the string text>)
or Double.parseInt(...) for non integral values
3. Apply the calculation that you need -> http://java.sun.com/docs/books/tutorial/java/nutsandbolts/arithmetic.html
4. write it back to file (can be the same file) -> http://javaalmanac.com/egs/java.io/WriteToFile.html
0
 
Mayank SAssociate Director - Product EngineeringCommented:
>> or Double.parseInt(...) for non integral values

Double.parseDouble () :)
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
aozarovCommented:
>> Double.parseDouble () :)
Right, thanks :-)
0
 
swaroopanlAuthor Commented:
If anynone of you could provide me code I would really appriciate the problem is I need to write series of numbers to a file and read fromthe file and read the numbers that I have writted to file and perform the caluclations and display that on the screen.
thanks
0
 
aozarovCommented:
We can't provide you with a complete program. (against the policy of this site).
Each one of the links above is pointing to code example of how to do that action.
In addition I gave you the flow of your program.
What left is to put each one of those examples one after the other and apply your own calculation.
Start with that and post any problem in this thread.
0
 
swaroopanlAuthor Commented:
thanks aozarov
I will get abck on this to you later at themoment I am real busy with other projects bye
0
 
aozarovCommented:
Sure, no problem I will be glad to help though you don't have to close the question if you are not sure if it is working for you.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now