Question
You will write a program that will convert a file of objects to a plain ASCII character text file yankees.txt (using plain character streams of
You will write a program that will convert a file of objects to a plain ASCII character text file yankees.txt (using plain character streams of individual characters). Copy the attached yankees.yanks object input file and save into your project folder. Copy the attached yankees.java class definition file and save into your package. You will then create a main program that will read an entire record (an object from this yankees.yanks file), get each field separately and convert each field into a separate character stream, and write the character streams of individual characters (in a loop) to a plain ASCII output text file called yankees.txt (you can open it in Eclipse from your project folder). Each field value will be a separate loop and you will only write one character at a time from each field (note: the only output to the yankees.txt file will be to write one individual plain ASCII text character at a time). In the output file, put each yankees record on a separate line with a space character between each field and a new line or return character at the end of each record. Continue reading objects until you reach the eof (at which point you will read a null, so you can read until you throw and catch an EOFException - but you don't have to print anything, just exit). Include catch blocks for any kinds of exceptions that might occur (print the stack trace and exit). Input: Read yankees objects from yankees.yanks in form of yankees.java. Output: Write individual ASCII characters from fields of yankees objects to yankees.txt. I'm confused on how to add the yankees.yanks.
This is the .java file mentioned above
import java.io.Serializable;
public class yankees implements Serializable
{
private static final long serialVersionUID = 7532751864233756487L;
private String name;
private String pos;
private int num;
public yankees(String na, String p, int nu)
{
name = na; pos = p; num = nu; } public String getname()
{
return name;
}
public String getpos()
{
return pos;
}
public int getnum()
{ return num;
}
}
**Here is the link to the yanks input file https://drive.google.com/open?id=1ANBRB5i_Z4T8et5IoWes9hz6VOughGUG
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