Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

5Write **TWO** programs. ********* PROGRAM 1: CreateBinaryUsingDataStream.java (1) Read students.txt that contains students' information. Each student' info consists of two lines: name and classification. -

5Write **TWO** programs. ********* PROGRAM 1: CreateBinaryUsingDataStream.java (1) Read "students.txt" that contains students' information. Each student' info consists of two lines: name and classification. - Use a Scanner to read the text file. - Store each student's information in a Student object and then add the Student object in an array list of Student. (2) Create a binary file "studentsDataStream.dat" using DataOutputStream. The program will need to write attribute by attribute to the file. ********* PROGRAM 2: ReadBinaryUsingDataStream.java It will read Student objects from the binary file created by Program 1 and print out the information for each student. In order to earn full credits, the program shouldn't assume knowledge that there are six Student objects are in the file. If your program read exactly 6 Student object, you can still earn partial credits for Program 2.

public class Student { private String name; private int classification; public Student(String name, int classification) { this.name = name; this.classification = classification; } public String getName() { return name; } public int getClassification() { return classification; } @Override public String toString() { return String.format("Student: %s %d", name, classification); } } 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And SQL For DB2

Authors: James Cooper

1st Edition

1583473572, 978-1583473573

More Books

Students also viewed these Databases questions

Question

=+b. ConAgra Foods (http://www.conagrafoods.com)

Answered: 1 week ago

Question

3. Write a policy statement to address these issues.

Answered: 1 week ago