1 / 3

PRG 421 Week 3 Individual Week Three Coding Assignment//tutorfortune.com

PRG 421 Week 3 Individual Week Three Coding Assignment//tutorfortune.com<br><br>Click on below link to buy<br>https://tutorfortune.com/products/prg-421-week-3-individual-week-three-coding-assignment<br><br>PRG 421 Week 3 Individual Week Three Coding Assignment<br><br>For this assignment, you will develop u201cstarteru201d code. After you finish, your code should access an existing text file that you have created, create an input stream, read the contents of the text flie, sort and store the contents of the text file into an ArrayList, then write the sorted contents via an ouput stream to a separate output text file.<br><br> <br><br>Copy and paste the following Javau2122 code into a JAVA source file in NetBeans:<br><br> <br><br>import java.io.BufferedReader;<br><br> <br><br>import java.io.BufferedWriter;<br><br> <br><br> <br><br> <br><br>public class Datasort {<br><br> <br><br>public static void main (String [] args) {<br><br> <br><br>File fin = // input file<br><br> <br><br>File fout = // create an out file<br><br> <br><br>// Java FileInputStream class obtains input bytes from a file<br><br> <br><br>FileInputStream fis = new FileInputStream(fin);<br><br> <br><br>// buffering characters so as to provide for the efficient reading of characters, arrays, and lines<br><br> <br><br>BufferedReader in = new BufferedReader(new InputStreamReader(fis));<br><br> <br><br>// declare an array in-line, ready for the sort<br><br> <br><br>String aLine;<br><br> <br><br>ArrayList<String al = new ArrayList<String ();<br><br> <br><br>int i = 0;<br><br> <br><br>while ((aLine = in.readLine()) != null) {<br><br> <br><br>// set the sort for values is greater than 0<br><br> <br><br>Collections.sort(al); // sorted content to the output file<br><br> <br><br>{<br><br>System.out.println(s);<br><br>}<br><br> <br><br>// close the 2 files<br><br> <br><br>}<br><br> <br><br>}<br><br> <br><br>Add code as indicated in the comments.<br><br> <br><br>Note: Refer to this weeku2019s Individual assignment, u201cWeek Three Analyze Assignment,u201d and to Ch. 8, u201cIO,u201d in OCP: Oracleu00ae Certified Professional Javau00ae SE 8 Programmer II Study Guide.<br><br> <br><br>Run and debug your modified program in NetBeans until it satisfies the requirements described above.<br><br> <br><br>Save your finalized JAVA file with a .txt extension.<br><br> <br><br>Submit your TXT file to the Assignment Files tab.<br> PRG 421 Week 3 Individual Week Three Coding Assignment<br>Click on below link to buy<br>https://tutorfortune.com/products/prg-421-week-3-individual-week-three-coding-assignment<br><br>

tutortip
Download Presentation

PRG 421 Week 3 Individual Week Three Coding Assignment//tutorfortune.com

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PRG 421 Week 3 Individual Week Three Coding Assignment//tutorfortune.com Click on below link to buy https://tutorfortune.com/products/prg-421-week-3-individual-week-three-coding- assignment PRG 421 Week 3 Individual Week Three Coding Assignment For this assignment, you will develop “starter” code. After you finish, your code should access an existing text file that you have created, create an input stream, read the contents of the text flie, sort and store the contents of the text file into an ArrayList, then write the sorted contents via an ouput stream to a separate output text file. Copy and paste the following Java™ code into a JAVA source file in NetBeans: import java.io.BufferedReader; import java.io.BufferedWriter; public class Datasort { public static void main (String [] args) { File fin = // input file File fout = // create an out file // Java FileInputStream class obtains input bytes from a file FileInputStream fis = new FileInputStream(fin); // buffering characters so as to provide for the efficient reading of characters, arrays, and lines BufferedReader in = new BufferedReader(new InputStreamReader(fis));

  2. // declare an array in-line, ready for the sort String aLine; ArrayList<String al = new ArrayList<String (); int i = 0; while ((aLine = in.readLine()) != null) { // set the sort for values is greater than 0 Collections.sort(al); // sorted content to the output file { System.out.println(s); } // close the 2 files } } Add code as indicated in the comments. Note: Refer to this week’s Individual assignment, “Week Three Analyze Assignment,” and to Ch. 8, “IO,” in OCP: Oracle® Certified Professional Java® SE 8 Programmer II Study Guide. Run and debug your modified program in NetBeans until it satisfies the requirements described above.

  3. Save your finalized JAVA file with a .txt extension. Submit your TXT file to the Assignment Files tab. PRG 421 Week 3 Individual Week Three Coding Assignment Click on below link to buy https://tutorfortune.com/products/prg-421-week-3-individual-week-three-coding- assignment

More Related