Create class named counter that has one string field

Assignment Help Computer Engineering
Reference no: EM13324001

In Eclipse, create a class named Counter that has one String field called text. It has a constructor that sets the one field from a parameter. It also has the following no-parameter methods: getCharCount that returns the number of characters in the text field, excluding '\n' (new line) and '\t' (tab) characters; getWordCount that returns the number of words in the text field, which are sequences of characters separated by new line, tab, space(s), period or comma; and getLineCount that returns the number of lines.

Also create a Main class that has the normal main method that you need to start the program. The main method should ask the user for the name of a local input file, and return an error message if it cannot find the file. The input file should be long and varied enough that you can test the Counter methods. Having found the file, your program should create a Counter object with a String parameter that has the contents of the input file. Then you print out the test string along with the various counts, including appropriate labeling of the numbers.

 

Reference no: EM13324001

Questions Cloud

Explain what is the strongest attractive force : What is the strongest attractive force that must be overcome in order to do the following: a) melt pure solid phosphorus pentachloride b) boil pure liquid selenium tetrafluoride
Compute his marginal cost and average cost of cutting lawns : Edward the entrepreneur takes two hours to cut a lawn, and he cuts 1,000 lawns per year, he use solar powered equipment thw will last forever and can be sold for $20000. the interest rate is 10 perent given his current output level, compute his margi..
How the listed variables impact the prices : Mr. Curtis explaining how the listed variables impact the prices of call options and what the associated theory is behind each relationship:
Determine the mass distribution of lead in the marsh : If metal sorption to algae can be modeled by a Langmuir isotherm, determine the mass distribution (sorbed vs dissolved) of lead in the marsh. Langmuir Isotherm Parameters Cs , sat 100 mg/g a 0.1 L/mg
Create class named counter that has one string field : create a Main class that has the normal main method that you need to start the program. The main method should ask the user for the name of a local input file.
Determine the volume of the paint : A partly-full paint can has 0.82 U.S. gallons of paint left in it. What is the volume of the paint
Explain how to boil pure liquid methanol : What is the strongest attractive force that must be overcome in order to do the following: a) melt pure solid phosphorus pentachloride b) boil pure liquid selenium tetrafluoride c) boil pure liquid methanol (CH3OH) d) sublime pure solid carbon dio..
What are the firms earnings per share : If the Marifield Steel Fabrication Company earned $500,000 in net income and paid a cash dividend of $300,000 to its stockholders and what are the firm's earnings per share if the firm has 100,000 shares of stock outstanding?
Create a gui system that will allow a user to add and remove : Create a GUI system that will allow a user to add and remove employees where each employee has an employee id (six-digit number), employee name, and years of service.

Reviews

Write a Review

Computer Engineering Questions & Answers

  New system implementation

In new system implementation, what could you do as the lead system designed to assure the implementation went smoothly?

  An example of the complexities involved in the case

We know there are problems of understanding natural languages as opposed to formal programming languages. As an instance of the complexities involved in the case of natural languages, identify situations in which the question "Do you know what tim..

  Express the concept of knowledge management

How data, information and knowledge are related to the concept of knowledge management? How are they different? Please define each one: data, information, knowledge and KM.

  Global economy

Explain why is the global economy so vital today? Explain how the global economy has altered since the mid-twentieth century.

  The advantages and disadvantages of using functions

Show how you might write the "case" statement using only the "if" statement in its place an actual case statement. Hint: Nested if statements. Explain your code.

  Explailning the forensic investigative approach

We require to assure this applicant know how to find the facts of incident and develop an initial forensic investigative approach.

  Program to calculate the weight of students

We have run regression analysis along with the resulting estimated regression equation as follows:” the estimated weight equals (-180 pounds) plus (5 pounds times the height in inches).” Write down the program to calculate the weight of students.

  Find out coding of binary information and error detection

find out Coding of Binary Information and Error Detection.

  Describe the different roles

define the different roles you think might be fulfilled by Web Services and Web Portals. What do you see as the major distinctions between the two from the perspective of provisions of eBusiness services? Which do you think is the more useful in t..

  Difference between lan or wan

What are the different sorts of network topologies used on a LAN or WAN?

  Impact of computer on people and organizations

Impact of computer on people and organizations

  What will offer as a network suggestion

With true VPN access to basically an Intranet Environment at each office; there really should not be any need for "Routing" per se unless I am missing something. I only have 2 days for this project before I head back to field, so I just need some ..

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