Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Download and import the LabDocumentationGiven.zip project. Rename the project to: sidd 4 7 9 0 _ l 0 1 This project contains a ScannerTest class

Download and import the LabDocumentationGiven.zip project. Rename the project to:
sidd4790_l01
This project contains a ScannerTest class and a Main class to test the ScannerTest class. Using the Scanner methods listed in the Java API documentation, alter the ScannerTest class to do the following:
Update the countLines method to count the number of lines in a file. The main method opens the source code file as a File object to use for testing:
File file = new File("src/cp213/ScannerTest.java");
Scanner source = new Scanner(file);
Note that Java looks for data files in the project's root folder. Note also that Java may wish to throw an Exception if the file cannot be found.
Update the countTokens method to count the number of tokens in the file. A token is anything that is surrounded on both sides by a space character - a space, tab, end of line, or end of file/string. Each word in this paragraph is a separate token.
Update the readNumbers method to quit only when a q is entered and to reject all other non-integers with the error message: not an integer . Example:
5
8
what?
'what?' is not an integer or 'q'.
how about 7?
'how about 7?' is not an integer or 'q'.
7
q
For the programs you just finished writing include the following documentation:
Author of the class.
Description of the class.
Description of each method.
Generate javadoc for these classes using Eclipse.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Query Formulation And Administration Using Oracle And PostgreSQL

Authors: Michael Mannino

8th Edition

1948426951, 978-1948426954

More Books

Students also viewed these Databases questions

Question

Distinguish between hearing and listening.

Answered: 1 week ago

Question

Use your voice effectively.

Answered: 1 week ago