Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can someone how me how to get started on this? I will need to parse a file that

ID: 3651983 • Letter: C

Question

Can someone how me how to get started on this?

I will need to parse a file that contains records consisting of first name, last name, middle initial, and date of birth.


Using Java, write a program that:
1. Create a binary version of the text file. Call it the same name with a .dat extension.
2. Write out a file called outputerror.txt that contains lines that you had problems with parsing. These lines should not be put inside the binary file.
3. Write a summary.txt file that contains the number of records read, number of good records read and the number of bad records skipped. Have this file also show the amount of time it took to run the conversion process. Also write the contents of the first five records of data and the last five records of data in the binary file, and the total number of records in the binary file.
4. Use RandomAccessFile to provide access to records within the file.
5. Create a prompt based interface for the user to retrieve a certain record from a certain line of the binary file.

Explanation / Answer

import java.io.*; import java.util.*; public class Inventory { public static void main(String[] args) throws ClassNotFoundException, IOException { DataInputStream input = new DataInputStream(new FileInputStream("inventory.dat")); boolean eof = false; while(eof == false) { char[] value = {'0', '1'}; int b = input.readUnsignedByte(); if (b == -1) { eof = true; } StringBuilder sb = new StringBuilder(); for(int i = 0; i < 8; ++i) { sb.append(value[b % 2]); b /= 2; } System.out.println(sb.reverse()); } input.close(); }//end main method }//end Inventory class