Write a program that asks a user for a file name

Assignment Help Basic Computer Science
Reference no: EM131318760

1. Can the readFile method in Section 11.8 throw a NullPointerException? If so, how?

2. Write a program that asks a user for a file name and prints the number of characters, words, and lines in that file.

3. Write a program that asks the user for a file name and counts the number of characters, words, and lines in that file. Then the program asks for the name of the next file. When the user enters a file that doesn't exist, the program prints the total counts of characters, words, and lines in all processed files and exits.

Reference no: EM131318760

Questions Cloud

Implement a subclass square that extends the rectangle class : Also supply a method get Area that computes and returns the area of the square. Write a sample program that asks for the center and side length, then prints out the square (using the to String method that you inherit from Rectangle) and the area o..
What access attribute should instance variables have : What access attribute should instance variables have? What access attribute should static variables have? How about static final variables?
Describe all constructors of the savings account class : Can you convert a superclass reference into a subclass reference? A subclass reference into a superclass reference? If so, give examples. If not, explain why not.
What happens if an exception does not have a matching catch : Is the type of the exception object always the same as the type declared in the catch clause that catches it?
Write a program that asks a user for a file name : Write a program that asks a user for a file name and prints the number of characters, words, and lines in that file.
Write a program that checks spelling of all words in a file : The program should print out all words that it cannot find in the word list.
Can you spot a trend in the frequencies : Modify the BabyNames.java program so that it prompts the user for a file name. The numbers in the files have comma separators, so modify the program to handle them. Can you spot a trend in the frequencies?
Prints all names that are both boy and girl names : Write a program that reads a file in the same format as babynames.txt and prints all names that are both boy and girl names (such as Alexis or Morgan).
What is the purpose of the finally clause : What happens when an exception is thrown, the code of a finally clause executes, and that code throws an exception of a different kind than the original one? Which one is caught by a surrounding catch clause? Write a sample program to try it out.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Highest normal form

Each DEPARTMENT has one CHAIR. The Primary Key of this relation is FACULTY_NAME. What is the highest Normal Form that this relation is in?

  Actual building and the actual building

An image of a building in a photograph is 6 centimeters wide and 11 centimeters tall. Ifthe image is similar to the actual building andthe actual building is 174 meters wide, howtall is the actual building, in meters?

  Instances of attribute minimization

Describe attribute minimization. Explain what would happen if you tried to validate a page containing instances of attribute minimization. Propose a solution to this problem.

  Computers to access other computers

A modem allows computers to access other computers through all of the following types of connections EXCEPT

  Considering that computing networks

TOPIC: CONSIDERING THAT COMPUTING NETWORKS ARE MORE AND MORE INTEGRATED IN ALL ASPECTS OF OUR LIVES, DISCUSS/PROPOSE A NEW/POSSIBLE IDEA ON HOW THESE NETWORKS CAN BE KEPT SAFE FROM HACKING, AND HOW TRANSMISSION OF DATA CAN BE SECURED END TO END..

  Field of computer science

What are primitive types and how are they applied in the field of computer science?

  Queen anne curiosity shop database schemashown

Draw an E-R data model for The Queen Anne Curiosity Shop database schemashown in Chapter 3's "The Queen Anne Curiosity Shop Project Questions." Usethe IE Crow's Foot E-R model for your E-R diagrams. Justify the decisions youmake regarding minimum ..

  Defeating physical security controls to bypass access

You might be wondering if physical security is really important in this digital age. After all, you have been studying how to protect IT assets via a keyboard, not by wearing a security officer's uniform and guarding the server room's door. Should..

  How the translation from cars to autos whse could be done

Show how the translation from Cars to Autos Whse could be done by a SQL query.

  Applications in a language and system independent way

Which is the protocol for performing RPCs between applications in a language and system independent way?

  Student lab activity

Given a set of program specifications for a simple business problem that requires the use of a collection of data to solve a business problem, code and test a program that implements arrays that meet the specifications and employ best programming ..

  Provide a common and consistent office solution

A school decides it wants to provide a common and consistent "office" solution (a software package that includes word processing, spreadsheets, presentation capabilities, and drawing capabilities) to all students and teachers in the school. The schoo..

Free Assignment Quote

Assured A++ Grade

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!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd