Already have an account? Get multiple benefits of using own account!
Login in your account..!
Remember me
Don't have an account? Create your account in less than a minutes,
Forgot password? how can I recover my password now!
Enter right registered email to receive password!
Write a program that asks a user for a file name and prints the number of characters, words, and lines in that file.
the FileCounter class.
import java.io.FileReader; import java.io.IOException; import java.util.Scanner; import javax.swing.JFileChooser; /** This class prints a report on the contents of a file. */ public class FileAnalyzer { public static void main(String[] args) throws IOException { JFileChooser chooser = new JFileChooser(); if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) { FileReader reader = new FileReader(chooser.getSelectedFile()); Scanner fileIn = new Scanner(reader); FileCounter counter = new FileCounter(); counter.read(fileIn); fileIn.close(); System.out.println("Characters: " + counter.getCharacterCount()); System.out.println("Words: " + counter.getWordCount()); System.out.println("Lines : " + counter.getLineCount()); } } }
import java.util.Scanner; /** A class to count the number of characters, words, and lines in files. */ public class FileCounter { /** * instance variables */ //your code here... /** Constructs a FileCounter object. */ public FileCounter() { //Your code here . . . } /** Processes an input source and adds its character, word, and line counts to this counter. @param in the scanner to process */ public void read(Scanner in) { while (in.hasNextLine()) { String line=in.nextLine(); //Your code here. . . } } /** Gets the number of words in this counter. @return the number of words */ public int getWordCount() { //Your code here. . . } /** Gets the number of lines in this counter. @return the number of lines */ public int getLineCount() { //Your code here . . . } /** Gets the number of characters in this counter. @return the number of characters */ public int getCharacterCount() { //Your code here . . . } }
project will be to implement a shopping cart class with user interface (UI) that contains main() in Net Beans. The UI class will be used to perform user input/output and to invoke the appropriate methods of shopping cart class. When your program star..
Write down the application which displays series of TEN(10) multiple choice questions: questions must cover all the Java. Each question must have four possible answers and only one answer must be correct.
Write a computer program that will figure out the total of an order when given the amount of the order ($1000) and a sales tax rate of eight percent.
The Williamsburg Women's Club offers scholarships to local high school students who meet any of several criteria. Write an application that prompts the user for a student's numeric high school grade point average (for example, 3.2), the student's num..
In C#, Use a one-dimensional array to solve the following problem. A company pays its salespeople on a commission basis. The salespeople each receive $200 per week plus 9 percent of their gross sales for that week. For example, a salesperson who gros..
write java code to read integers from an input file and write only the odd numbers to an output file. the two file names will be provided on the command line as the input file followed by the output file.
Assignment 1: Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N !. For example, if the input is 4, the output could be:
Design and implement a small and simple email server
Create a Java class called SameArraysException that extends the Exception class.
Develop a graphical user interface based java program that can communicate with a real SMTP email server for sending emails
Your missions is to create the class Airplane. Each Airplane object should store the following information (fields):
Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!
whatsapp: +1-415-670-9521
Phone: +1-415-670-9521
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd