Write a complete Java program, including at least one comment in the main program and one in each method, to do the following: The program will read in an unknown number of records from a file. Assume you won't have more than 100 records in total, though the actual number of records can be less than 100. Each record contains a sales rep's first name and miles traveled on two trips per year. For example, Pauline 167.8 567.0 Main: 1. Declare an output file to be used in main and passed to one or more methods from main. All output from main and methods will be printed to this file. 2. Invoke the first method (below) to read the data from the input file, compute averages and store information in the arrays. The method returns the number of records read in. 3. Next, invoke the second method (below) which computes the average length of all trips and then prints to the output file how many individual averages are above, equal to and below the overall average. 4. Finally, invoke the third method (below) to sort the name and individual average trip length arrays in parallel 5. In main, print to the output file each sales rep name and average trip length. The names and average trip length should print in columns, right adjusted. All trip lengths should be printed with two decimal places. Methods: 1. This method has two parameters: a String array for names and a double array for the average trip length per individual sales rep. It returns an integer a. Declare the input file, read the records in the file and store each first name in an array (assume there are no duplicate names) and the average number of miles travelled for that sales rep in another array. You do not need to store the individual trip length. b. Return the number of sales rep records read in. 2. method has three parameters - the output file, double array of individual average trip length and an integer representing the total number of records read in. a. Compute the overall average trip length across all sales reps. b. Compute and print to the output file how many sales reps individual average trip length were above the overall average trip length, below the overall average trip length and equal to the overall average trip length. 3. This method has three parameters - String array of names, double array of individual average trip length and an integer representing the total number of records read in by the first method. a. Sort the sales rep names in descending (reverse) alphabetical order synchronizing the individual sales rep's average trip length in the parallel array.
sectetur a
sectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet
Unlock access to this and over
10,000 step-by-step explanations
Have an account? Log In
sectetur adipiscing e
sectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus
sectetur adipiscing elit. Nam lacinia pulvinar tortor n
sectetur adipiscing elit. Nam lacinia pulvinar tortor nec facil
sectetur adipiscing elit. Nam lacin
sectetur adipiscing elit. Nam lacinia pulvinar tort
sectetur adipiscing elit. Nam lacinia pulvinar to
sectetur adipiscing elit. Nam lacinia pulvina
sectetur adipiscing elit. Nam lacinia pulvi
sectetur ad
sectetu