View the step-by-step solution to:

Anthony W. Smith, 2016 CSCI 114 Programming Fundamentals II Lab 6 Files Lab 6 Files Purpose Purpose is to practice using file input and output, and...

Hi, can you please help me with this question. the attached pdf is what entails the problem. thank you.

© Anthony W. Smith, 2016 CSCI 114 Programming Fundamentals II Lab 6 Files 1 Lab 6 Files Purpose Purpose is to practice using file input and output, and array list of objects. Also, this document tells you only what to do, you now have more responsibility to design how to do it. Problem description You are given a text file called ' Students.txt ' that contains information on many students. Your program reads the file, creating many Student objects, all of which will be stored into an array list of Student objects, in the Students class. The Tester class controls everything, calling many Students class methods to produce lots of different outputs. The program must write the output to an output file and to the Terminal Window. File and class specifications Students.txt file format Information for each student is stored in the file as 3 lines of text: name age GPA e.g. the following shows data for two students: Name0 22 1.2 Name1 22 2.71 Student class The Student class has instance variables and methods to represent one single student. Your Student class must have exactly and only the following instance variables: private String name; private int age; private double gpa;
Background image of page 1
© Anthony W. Smith, 2016 CSCI 114 Programming Fundamentals II Lab 6 Files 2 Design appropriate constructors and other methods for your Student class, including: + toString() – returns a String containing the 3 instance variables e.g. Name0 22 1.2 Students class Very importantly, the Students class is used to store and process many Student objects. It will have an instance variable to store many Student objects. Methods intended to process many Student objects belong in this Students class. Your Students class must have exactly and only the following instance variable: private ArrayList<Student> students; students here is an array list of Student objects, in which all of the Student objects are stored. Students must have appropriate constructors and methods, including the following: + readFile() – opens the data file, reads the data, creates Student objects, and adds them to the students array list + toString() – returns a String containing a line of information for each Student in the students array list. Will call Student 's toString() to do this. For example: Name0 22 1.2 Name1 22 2.71 Many other methods for processing a Students object. Most of the code you write will be in this class. Reading the data file Your program will use the Scanner class to read from the data file, as demonstrated during the Week 13. Files lecture. Writing the output file Your program must use the PrintWriter class to save all its output to the output.txt file, as demonstrated during the Week 13. Files lecture. It will also send the same output to the BlueJ Terminal Window, as usual.
Background image of page 2
Show entire document
Sign up to view the entire interaction

Top Answer

Find the solution attached... View the full answer

output.txt

Student with best GPA is: Mini 23 4.5
Average GPA is: 2.75
Youngest student below average GPA is: Simi 21 1.0 Sam
Max
Simi
Mini

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask a homework question - tutors are online