Answered step by step
Verified Expert Solution
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: siddl 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: package cp; import java.util.Scanner; Class to demonstrate the use of Scanner with a keyboard and File objects. @author your name here @version public class ScannerTest Count lines in the scanned file. @param source Scanner to process @return number of lines in scanned file public static int countLinesfinal Scanner source int count ; your code here return count; Count tokens in the scanned object. @param source Scanner to process @return number of tokens in scanned object public static int countTokensfinal Scanner source int tokens ; your code here return tokens; Ask for and total integers from the keyboard. @param source Scanner to process @return total of positive integers entered from keyboard public static int readNumbersfinal Scanner keyboard int total ; your code here return total; 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 FilesrccpScannerTestjava"; Scanner source new Scannerfile; 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 filestring 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 nonintegers with the error message: not an integer Example: what? 'what? is not an integer or q how about 'how about is not an integer or q 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.
Download and import the LabDocumentationGiven.zip project. Rename the project to:
siddl
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: package cp;
import java.util.Scanner;
Class to demonstrate the use of Scanner with a keyboard and File objects.
@author your name here
@version
public class ScannerTest
Count lines in the scanned file.
@param source Scanner to process
@return number of lines in scanned file
public static int countLinesfinal Scanner source
int count ;
your code here
return count;
Count tokens in the scanned object.
@param source Scanner to process
@return number of tokens in scanned object
public static int countTokensfinal Scanner source
int tokens ;
your code here
return tokens;
Ask for and total integers from the keyboard.
@param source Scanner to process
@return total of positive integers entered from keyboard
public static int readNumbersfinal Scanner keyboard
int total ;
your code here
return total;
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 FilesrccpScannerTestjava";
Scanner source new Scannerfile;
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 filestring 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 nonintegers with the error message: not an integer Example:
what?
'what? is not an integer or q
how about
'how about is not an integer or q
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started