Question
You are given a comma-separated file of student names that has the row format First Name, Last Name, Logon ID, Random Number Currently, the lines
You are given a comma-separated file of student names that has the row format First Name, Last Name, Logon ID, Random Number
Currently, the lines are sorted by the last name entry. Also note that not all rows contain all values, correct values, or too many values. You are to write a program with several classes and methods that perform different operations on the data. The individual methods should be called from your programs main class. Also, make sure that you comment your code for fullpoints - note the rubric!
1. Write a method that asks the user for the file location and returns the user input as File if and only if the file exists and is readable. Otherwise, the method should be indefinitely executed. Read the file in, one student at a time, by utilizing the following.
2. Generate a class Person for the individual people in the file, which holds the first and last names.
2. Generate a class Student extending Person for the individual rows in the text file, i.e., a class that holds the additional required items for each student. Include constructors for the scenarios that you can encounter. Perform the following basic string manipulations as you process the entries: a. The Logon ID should always be all low-caps, b. Random numbers that are not given in the text file should be replaced with the string "0", and c. If any other entries in a row are missing (or if there are too many entries), the entire row should be discarded and the user informed about the row that was discarded and its original line number in the text file as it is read.
3. . Generate an aggregated class for all the student entries (rows) in the CSV file. Include a constructor as well as a method addStudent which adds a Student object to the aggregated class. Include a toString method that returns all students as a single String. Hint: You will need an array of type Student.
4. Generate public methods in the aggregated class to a. Calculate the sum of all random numbers getSum, returns long, b. Count the student entries getStudentCount, returns int, c. Get the maximum random number row (array index) getMaxIndex, returns int, d. Get the minimum random number row (array index) getMinIndex, returns int, and e. Return a student at a specific index i from the array as getIndex, returns Student.
5. Print the following items to standard output: a. All entries that make up your aggregated class instance after loading b. Sum of all random numbers c. Count of entries d. Average of all random numbers e. Maximum random number f. Minimum random number
Jakelin | Sandy | JaSa12 | 99 |
Marque | Angel | mAang99 | 66 |
Mack | Arushi | MaAr47 | 33 |
Dakson | Evangelyne | dakEva11 | 15 |
Shree | Korynne | Shrek1 | 11 |
Yoan | Neenah | Neena1 | |
Iroh | Daviona | Irode2 | 369 |
Azura | Ziyan | 37 | |
Mirelle | Nylaa | Minny9 | 49 |
Melaine | Mayme | Mame66 | 122 |
Jeriah | Isayah | JeRa7 | 47 |
Rayshon | Axelle | 123456 | 13 |
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