Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are given a comma-separatedfile of student names that has the rowformat First Nase, L Nase, Logon ID, Randon nunber Currently, the lines are sorted

image text in transcribed
You are given a comma-separatedfile of student names that has the rowformat First Nase, L Nase, Logon ID, Randon nunber Currently, the lines are sorted by the first 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 program's main class. Also, make sure that you comment your code for full points- note the rubrict Write a method that asks the user for the file location and returns the user input as Pi le 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 Student for the individual rows in the text file, Le, a class that holds the 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: 1 The Logon id should always be all low-caps 2. Random numbers that are not given in the text file should be replaced with the string "O. 3. If any other entries in a row are missing (or if there are too many entries), the entire rowshould be discarded and the user informed about the row that was discarded and its original ine number in the text file Hint: you need the String, apl it (*) function here to break the string apart into another array of string, check/modify values, and finally reassemble the checked values again into a new string 3. Generate an aggregated class for all the student entries (rows) in the CSVfile. 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 ArrayList oftype Student 4. Generate public methods in the aggregated class to 1. Calculate the sum of all random numbers getsus, returns long 2. Count the student entries getStudentCount, returns int 3. Get the maximum random number row (array index) gethaxIndex, returns int 4. Get the minimum random number row (array index) getMinIndex, returns int S. Return a specific index i from the array get Index, returns Student 14) 5. Write a method each that determines the following values from the cleaned array input 1. Sum of all random numbers (returns long) 2. Average of all random numbers (returns double) 3. Row in the cleaned array with maximum random number (returns long) 4. Row in the cleaned array with the minimum random number (returns long Hint: you need the Stringsplit". *) function here to break the string apart into another array of string, then convert the String to a long value using Long-parselong(String a) 6. Print the following items to standard output 1. All entries that make up your aggregated class instance 2Sum of all random numbers 3. Count of entries 4. Average of all random numbers 5. Maximum random number 6. Minimum random number

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

Step: 3

blur-text-image

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

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

3rd Edition

978-1119907466

More Books

Students also viewed these Databases questions

Question

Many different people can conduct performance appraisals.

Answered: 1 week ago