1. Engineering
  2. Computer Science
  3. i wrote a program that takes a userentered character and...

Question: i wrote a program that takes a userentered character and...

Question details

import java.util.scanner; import java.io. public class FileLetterCounter public static void main(String [] args) throws IOException String fileName; Scanner input new Scanner(System.in); System.out print Enter the name of a file:) fileName input.nextLine): File file new File(fileName + *.txt); if file.exists)) System.out.print(File does not exist Scanner fileInput- new Scanner(file); System.out-printin(Enter a character you want String charinput:ǐnput.nextLine(); char character charinput, charAt(8); counted: String line; nt count while fileInput.hasext)) line-fileInput.nextline: for(int i-iine.length):i) if(line.charAt(i)character) count*-1; System.out.println(The character+characterappears in the file counttie(s).) fileInput.close)

I wrote a program that takes a user-entered character, and counts how many times it's found in a user-specified file. The program works; however, I need to convert the program so that input/output is done using JOptionPane.

I've never used JOptionPane so I'm a little confused by it

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution