Question & Answer: 0000 Verizon 10:56 AM a bbprod.hwcc.edu In this project, you will input student data from a file – create student objects add student objects to an array -…..

.0000 Verizon 10:56 AM a bbprod.hwcc.edu In this project, you will input student data from a file - create student objects add student objects to an array - write the student object data to standard output Download the input text file studentinput3.txt. This file contains four sets of data. Each set of data includes four lines that correspond to one students data. The first line is the students first and last name, the second line is the students id number, the third is the students year and the fourth contains the students major Modify your RunStudent program from project 2 to create a Student array, read the sets of data, create a student object, add the object to the array, and print the array. There are many different ways to do this, but we will do i in the most basic way The first question is: do we know how many sets of data are in the file? If we do, and if this number is not likely to change, a for loop and an array are fine to use. An array has a set size that cannot be changed. So, if we know we will only have 10 students, we can create a Student array of size 10 and use a for loop to traverse the input file. If we have a file, but do not know how many students are contained in the file, an array might not be our best bet. An ArrayList has room for 10 elements by default, but can grow and shrink. An ArrayList has methods to add elements that do the work for us if the list gets too large for the current size. But deep down inside, an ArrayList contains an array. For this project, we know that we will only have four students, so we will create an array of size 4. Since we have only four students, this means we will have four sets of data. This makes reading from the file casy: a for loop that executes four times and reads the four lines of data during each loop iteration. Reading the data from the file can be tricky It would be best to get this part of the program working first before you proceed to the rest of the program. It is always important to make sure the data structures appropriately contain the data. The last step will be to create a method in the RunStudent class that writes the content of the array to standard output.
media%2F5ba%2F5bafef70-d921-4d19-8bee-f6
media%2Fbff%2Fbff93418-708a-4987-8742-40
media%2F928%2F928db129-3d47-4023-b2d0-52

0000 Verizon 10:56 AM a bbprod.hwcc.edu In this project, you will input student data from a file – create student objects add student objects to an array – write the student object data to standard output Download the input text file studentinput3.txt. This file contains four sets of data. Each set of data includes four lines that correspond to one student’s data. The first line is the student’s first and last name, the second line is the student’s id number, the third is the student’s year and the fourth contains the student’s major Modify your RunStudent program from project 2 to create a Student array, read the sets of data, create a student object, add the object to the array, and print the array. There are many different ways to do this, but we will do i in the most basic way The first question is: do we know how many sets of data are in the file? If we do, and if this number is not likely to change, a for loop and an array are fine to use. An array has a set size that cannot be changed. So, if we know we will only have 10 students, we can create a Student array of size 10 and use a for loop to traverse the input file. If we have a file, but do not know how many students are contained in the file, an array might not be our best bet. An ArrayList has room for 10 elements by default, but can grow and shrink. An ArrayList has methods to add elements that do the work for us if the list gets too large for the current size. But deep down inside, an ArrayList contains an array. For this project, we know that we will only have four students, so we will create an array of size 4. Since we have only four students, this means we will have four sets of data. This makes reading from the file casy: a for loop that executes four times and reads the four lines of data during each loop iteration. Reading the data from the file can be tricky It would be best to get this part of the program working first before you proceed to the rest of the program. It is always important to make sure the data structures appropriately contain the data. The last step will be to create a method in the RunStudent class that writes the content of the array to standard output.

Expert Answer

 

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

Don't use plagiarized sources. Get Your Custom Essay on
Question & Answer: 0000 Verizon 10:56 AM a bbprod.hwcc.edu In this project, you will input student data from a file – create student objects add student objects to an array -…..
GET AN ESSAY WRITTEN FOR YOU FROM AS LOW AS $13/PAGE
Order Essay

/**
*
* @author Sam
*/
public class Student {
private String name;
private String idNum;
private String year;
private String major;

public Student(String name, String idNum, String year, String major) {
this.name = name;
this.idNum = idNum;
this.year = year;
this.major = major;
}

public String getName() {
return name;
}

public String getIdNum() {
return idNum;
}

public String getYear() {
return year;
}

public String getMajor() {
return major;
}

@Override
public String toString() {
return “Student name: ” + name + “nID Number: ” + idNum
+ “nYear: ” + year + “nMajor: ” + major + ‘}’;
}

}

class RunStudent {
public static void main(String[] args) throws IOException{
String name;
String idNum;
String year;
String major;
int i = 0; //index
BufferedReader br = new BufferedReader(new FileReader(“studentInput3.txt”));
Student[] students = new Student[4];
while ((name = br.readLine())!= null) {
idNum = br.readLine();
year = br.readLine();
major = br.readLine();

if (year.equalsIgnoreCase(“F”))
year = “Freshman”;
else if (year.equalsIgnoreCase(“O”))
year = “Sophomore”;
else if (year.equalsIgnoreCase(“S”))
year = “Senior”;
else if (year.equalsIgnoreCase(“J”))
year = “Junior”;

students[i++] = new Student(name, idNum, year, major);
}
br.close();

printStudentArray(students);
}

public static void printStudentArray(Student[] a) {
for (Student s:a)
System.out.println(“n———————————–n”
+ s.toString()
+ “n———————————–n”);
}
}

This code is sufficent for

Grand Paper Writers
Order NOW For A 10% Discount!
Pages (550 words)
Approximate price: -

Our Advantages

Plagiarism Free Papers

All papers are written by the best professional writers to ensure 100% originality. We always provide plagiarism reports whenever we deliver completed papers.

Free Revisions

All papers by Grand Paper Writers are completed and submitted on time. This timely delivery of papers gives you time to go through the paper before the official deadline.

Title-page

As an additional service, we will provide a title page that precedes the contents of your paper. Here, you will provide your personal details.

Bibliography

We also ensure that we provide an extra page for the references or bibliographies following referencing rules.

Originality & Security

At Grandpaperwriters.com, we guarantee students for the provision of security and original work. All your personal information is handled with confidentiality and is not shared with third parties. Additionally, we ensure that we provide original content with accompanying plagiarism reports to show originality.

24/7 Customer Support

Our customer support team is always available 24/7 to provide instant responses to any queries raised by students.

Try it now!

Calculate the price of your order

We'll send you the first draft for approval by at
Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

Grandpaperwriters.com has the best professional essay writers for quality services.

Pricing

Flexible Pricing

Here, a Grandpaperwriters.com, we do not compromise on the time of our clients. We always deliver all completed papers on or before the deadlines.

Communication

Admission Help & Client-Writer Contact

Grandpaperwriters.com provides an interactive portal where students can communicate directly to their writers.

Deadlines

Paper Submission

Here, a Grandpaperwriters.com, we do not compromise on the time of our clients. We always deliver all completed papers on or before the deadlines.

Reviews

Customer Feedback

Grandpaperwriters.com appreciates feedback from our clients to help us improve the delivery of essay writing services. As such, we are constantly changing our policies to ensure maximum customer and writer satisfaction.