Java Create Text File Containing List Numbers Code Read File Compute Numerical Characteris Q37063649

Java

  1. Create a text file containing a list of numbers. In your code,read the file and compute the numerical characteristics: count allnumbers, compute the average of all numbers, count positivenumbers, anything else by your choice.

Answer


import java.io.File;import java.io.FileNotFoundException;import java.util.Scanner;public class FileNumberStats { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print(“Enter file name: “); File file = new File(in.nextLine()); try {

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.