Starting from:

$30

Lab 0 Solution

Provided is CSCD211Lab0.java that is an unchangeable Java file. Your task is to complete the program based on the specifications below.




You will prompt the user for the name of the input file. You must ensure the file exists, if it does not you must reprompt. The file will contain strings, one string per line. The string may contain spaces.



You will open that file and count the number of records in the file. There will be one string per line.



You will create and fill an array of type String for each String that is in the file.
The array is then sorted by calling the compareTo of String and you must write the selection sort method
After the array is sorted, the information is printed to the screen, each string will be on a separate line. Your output to the screen will be in the format similar as your input file.



CSCD211Lab0Methods




fillArray – creates and fills the array by reading from the file



printArray – Prints the information in the array calling the toString – one String per line.



NOTES




CSCD211Lab0 which contains main is in the folder cscd211Lab0
All parameters passed to a method will be final
All preconditions for the method will be checked
You may NOT assume the input file specified by the user exists. If it does not, print an error message and re-prompt the user for an input file name.
You must create an input file that allows you to sufficiently test the specifications of this lab.
You can only add your method code. You can’t change my imports or class in any fashion other than the few methods you have to write.
I have provided the Javadoc which contains more details, please refer to the Javadoc by opening the docs folder and selecting the file index-all.html



TO TURN IN




There are multiple turn ins for this lab.




Your stubbed out methods ensuring all code compiles will be submitted via git commit to your repository on GitHub. This is required within by NOON. You need to become very familiar with incremental builds and version control. GitHub allows you to maintain working code in a simple version control system.



A zip file, in Canvas, by the required due date containing:



all java files



the input file(s) used to test your program program
a test run named cscd211lab0out.txt – testing all aspects
We should be able to download the zip and compile your code, and then run your code.
Name your zip, your last name first letter of your first name lab0.zip (Example: steinerslab0.zip)

More products