java - how can i save the avg to a text file and be printed out -


How do I take the average of the program falling down and come into a text file to be printed out

Import java.util.Scanner; Public class freethrowpercent {public static zero main (string [] args) {double freethrowsmade = 1; Double freudrojation = 0; Scanner input = new scanner (System.in); System.out.println (enter 1 for freethrows if "Enter 1 freethorw"); Freethrowsmade = input.nextDouble () + 1; Freethrowsmissed = input.nextDouble () + 0; Double reply = frathosomed / 2 * 100; System.out.println ("percent is" + answer); }

If it is possible

First, I suggest I am familiar with Java

If you intend to write answer in a file, then there is a way to do this:

  FileWriter author = zero; Try {string str = Double.toString (Answer); File f = new file ("/ path / to / file.txt"); Author = new freeware (F); Writer.write (STR); } Hold (IOException pre) {} finally {try {writer.close (}}} hold (IOException pre) {}}}  

Comments