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

  Effective advanced filtering and search interface

Describe the most effective advanced filtering and search interface. Argue why the interface you chose is more effective than others, and describe who benefits most from the interface you are describing.

  Evaluating computer hardware and system software

Prepare a list containing at least 10 criteria for evaluating computer hardware and system software. The method for evaluating alternatives called weighting and scoring implies that the total utility of an alternative is the product of the weights..

  What is the reaction of the tcp client to this event

If the client has no data to be sent at this moment and has acknowledged the previous segment, what is the reaction of the TCP client to this event? Can you justify the reaction?

  Interface perating system with uninterruptible power supply

Windows XP Professional can interface through the operating system with an Uninterruptible Power Supply (UPS).

  Problem regarding the audio and html5

HTML5 supports several formats of audio. However, there is no single format that is compatible with every browser. Analyze two different ways that this issue can be addressed. Select the best solution for this issue and explain why you chose it.

  Difference between it and information systems

Discuss the advantages and disadvantages of spreadsheet software as number-crunching software.

  Explain what a buffer overflow is how it can be used

Explain what a buffer overflow is, how it can be used by an attacker, and how to prevent such as an attack.

  Risks associated with directly executing user input

What are the risks associated with directly executing user input? What are the minimum steps needed to parse user input before it is allowed to be used in execution?What are the risks associated with inheritance in classes? Why are generic classes bo..

  Three physical locations distributed across the county

The Banana Tree Travel Agency is expanding from a single physical location to three physical locations distributed across the county to better serve the needs of their customers.

  What did the responsibilities of each entail

what did the responsibilities of each entail?

  What is the swap space amount for the bash command

If using a long listing and no process modifiers, what is the swap space amount for the bash command?

  Executive summary and report

Read the Cyber Risk Report 2015 - Executive Summary and Report (Hewlett Packard, 2015), and the article Surveillance programs may cost US tech over $35 billion and its competitive edge (Taylor, 2015).

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