10年專注于英語國家留學生作業代寫,網課代修,網課Exam代考
java代寫_java代碼代寫_代做java作業_DueEssay論文代寫

java代寫_java代碼代寫_代做java作業

計算機作業代寫 、 cs代寫 ---java代寫,java編程代寫, java程序代寫 ,java作業代寫, 我們提供各種編程語言和寫作服務課程,包括c / c ++,java,python,php,matlab,網站設計,前端開發,..

2957088488

java代寫_java代碼代寫_代做java作業

發布時間:2021-12-04 熱度:

計算機作業代寫cs代寫---java代寫,java編程代寫,java程序代寫,java作業代寫,我們提供各種編程語言和寫作服務課程,包括c / c ++,java,python,php,matlab,網站設計,前端開發,小型游戲設計,作業,實驗室,考試等。
 


 
CS代寫、計算機作業代寫,java代寫,python代寫,c/c++代寫

提供專屬的CS程序代寫、math代寫、金融代寫、統計代寫、商科代寫、economic代寫服務,代寫各類程序語言:C語言代寫, C++代寫, 算法作業代寫, 數據結構代寫, AI/MachineLearning代寫, python代寫, java代寫, matlab代寫, 匯編代寫, scala代寫, SQL/Database代寫, racket代寫, 安卓/Android代寫, IOS/swift代寫, racket代寫, 網絡代寫, web代寫, OS/操作系統代寫, R代寫等, 新增代寫STAT, math, business代寫, economic代寫等,涵蓋北美CS代寫,  加拿大CS代寫,  美國CS代寫,  澳洲CS代寫,  新西蘭CS代寫,  英國CS代寫,  新加坡代寫,  香港CS代寫等.

You should carefully read through all the code before starting on the assignment.

Paths, Files, Reading and Writing
This assignment requires creating, reading and writing files. Your assignment project directory contains a directory “data”. This directory contains some CSV files that you should use in development and testing.

You should only read files from this directory and write files to this directory. The only files you write to should have names that start with “temp_”. The marking software will run your code in a secure sandbox environment and any attempts to read or write outside this directory or to write to a file whose name does not start with “temp_” will cause an exception to be thrown and your program to fail.
The java.nio.file.Path class represents full and partial file path strings to be handled. By default, when your program starts, it does so with your project directory as its current working directory. Therefore if you give a relative path name for a file you wish to read, e.g. “data/state-abbrevs.csv”, then it will look for that file path starting at your project directory. You will frequently want to be able to create paths to new files in the data folder:

Given a path variable dataDir to a directory, you can construct a path variable to a file given by a String
filename, “temp_copy.csv”, with: dataDir.resolve(“temp_copy.csv”)

You can also create a Path from Strings using calls like Paths.get(“data”) or Paths.get(“data”,

“temp_copy.csv”)

You can get the String name of a file (the last component of a path) with path.getFileName(). This acually returns a path with a single component, but the toString() method of Path will turn it into a string.
If you have the path of a file, and want to create the path of a new file in the same directory, you can use:
path.resolveSibling(“temp_new_file.java”)

You will need to generate names for your output files that do not clash with your input file names or any other output file names. To do this, make an output file name from the input filename in the form: if the input filename is “abc. csv”, make the output file name be “temp_00000_abc.csv”, where the number part can be incremented for each output that you need. If your input file Path in in the variable fromPath, and your temporary file number counter is in the integer variable tempNum, this can be done with:
Path tmpPath = fromPath.resolveSibling(

String.format(“temp_%05d_%s”, tempNum, fromPath.getFileName()) );

Scanner and PrintWriter

For this assignment, you should use the Scanner class for reading CSV files and the PrintWriter class for writing them. This ensures that all unicode characters are handled appropriately.

You can open a Scanner on a file specified by a Path object with:
Scanner from = new Scanner(fromPath);

The PrintWriter class does not currently support opening a file from a Path object, so you first have to turn the Path object into a File object:
PrintWriter to = new PrintWriter(toPath.toFile()))

Once you have opened a file, it is important to ensure that you close it:

Not closing it can mean that your program can crash if you open many files: there is a limit on how many files you can have open at the same time. While this limit is large, it is possible to hit the limit.
Not closing open files is a memory leak and wastes memory
Under some circumstances, not closing a file may cause some of the last writes to that file to not be saved to the file on disk
Therefore you should get in the habit of always closing your files. While you can close them directly, you have to ensure that they get closed even if an exception occurs before you make the call to close them. You can handle this with the try

… catch … finally construct, but there is a much easier and more convenient way: the try-with-resources construct:

try ( Scanner from = new Scanner(fromPath);

PrintWriter to = new PrintWriter(toPath.toFile()))

{

// do your reading and writing here – do not close

}

This form of try ensure that every resource which is constructed the “try” part is open with the following curly braces and is automatically closed when the program leaves the braces, whether that leave is caused by an exception, a return, or simply completing the code in the braces. Note that the code in the try part is a series of assignments separated by semi-colons. You can have as many as you like. You can also nest them, if you wish:

try ( Scanner from = new Scanner(fromPath) )

{

// read from “from” here

try ( PrintWriter to = new PrintWriter(toPath.toFile()) )

{

// Read from “from” and write to “to” here

}

// read from “from” here

}

Priority Queues and Comparators
A PriorityQueue is Java’s implementation of the Priority Queue data structure. To use it you need to use a Comparator object which tells the PriorityQueue how to compare the objects that you put into it. The CsvFormatter class contains a nested CsvComparator class that is suitable for this purpose. Since it is nested inside CsvFormatter, you can only create a CsvComparator object from a CsvFormatter object as follows:

CsvFormatter formatter = … // get a formatter object

String columnName = “abbreviation”; // the header of the column used for comparing CSV rows

CsvFormatter.RowComparator comparator = formatter.new RowComparator(columnName)

For this assignment, you will need to put CSV rows into it. These rows are implemented as arrays of Strings, so, given the

comparator created above, you can create a suitable new PriorityQueue as follows:

PriorityQueue<String[]> pq = new PriorityQueue<>(comparator);

Testing Arrays for Equality
Do NOT try to use the .equals method on an array of strings (i.e. a row) to check if the arrays are the same length and have the same strings: it sounds like it should work but, for good reasons, it is unlikely to do what you expect. The way to do what you want is to use Arrays.equals().

String[] row1 = … // get a CSV row

String[] row2 = … // get a CSV row

if (row1.equals(row2) // DO NOT DO THIS – IT IS VERY UNLIKELY TO DO WHAT YOU EXPECT



if (Arrays.equals(row1, row2)) // This does do what you almost certainly want



Final Instructions
The precise information about the behaviour required of the missing code is detailed in the Javadoc comments in the files.
You should modify the methods CsvUtils.getStudentId() and CsvUtils.getStudentName() in
CsvUtils.java to return your student id and name.

You should NOT add any further class variables to CsvUtils.java, or change the types or visibility of the existing class variables or methods nor modify any of the other files in the main part of the src tree.
You can add extra private methods in CsvUtils.java if you like but please note that they are not needed and my solution does not do so.
You can (and should!) modify the CsvUtilsTest.java file and you can add any other test files as you please. Your test files are for your own use and should NOT be submitted.
You should not modify the package structure or add any new classes that CsvUtils.java depends upon to run. Your final submission will be purely the CsvUtils.java file, so any modifications outside that file will not be considered and the CsvUtils.java file that you submit must work with the other files as they currently stand in the assignment structure.
You should not use any print statements to standard out or standard error streams: if you want to have some debug output, use the logging calls for Log4j. The logging system will be switched to disable log output when your submission is run for marking purposes.
For marking purposes, your code will be compiled and executed against a test set in a secure sandbox environment. Any attempts to break the security of the sandbox will cause the execution of your program to fail. This includes infinite loops in your code.
When you have completed your code changes to your satisfaction, submit your CsvUtils.java


關閉窗口
上一篇:Python代寫Programming作業_Python作業代寫
下一篇:代寫CS編程,JAVA作業代做、代寫JAVA設計編程

相關閱讀

?
代寫
微信

微信客服

微信客服:2957088488

山東濟南市歷下區三慶財富中心

qq

QQ客服

QQ聯系:2957088488

代写大神| 美国代写| 留学生代写|