• Post Reply Bookmark Topic Watch Topic
  • New Topic

write to a file and then implement if else  RSS feed

 
teja kol
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I find the biggest of 3 numbers and store it in a file and then implement if else if its greater than say 10000?
 
Carey Brown
Saloon Keeper
Posts: 3329
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Break down the requirements:
1. where do the 3 numbers come from?
2. how to find the biggest
3. how to store in a file
4. what actions do you want to take based on your if/else-if?
Take one of these requirements at a time. Come up with a design. Implement the design. Get it to compile. Test it thoroughly. Only then go on to the next requirement.
At each stage, if you are still having problems, post your code and specify where you are stuck.
 
Carey Brown
Saloon Keeper
Posts: 3329
46
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't write a console to a file. You can either output data to the console or output the data to a file. In order to output the largest number to a file you should store the largest number in a variable and then write the value of the variable out to a file. At this point I would recommend creating a separate method to do the writing.

Open a file for writing characters, e.g. PrintStream. Using that file handle call println( variable ). Close the file.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!