protype func getFileName(pass string by reference) protype func readData(pass fstream by reference, int array, int array, int array, int array, float array, float array, float array, float array, float array) protype func displayData(pass int array, int array, int array, int array, float array, float array, float array, float array, float array, int) def func main() init var pick_up_loc as int array with 50 slots init var drop_off_loc as int array with 50 slots init var pass_count as int array with 50 slots init var trip as int arary with 50 slots init var distance as float array with 50 slots init var fare_amount as float array with 50 slots init var toll_amount as float array with 50 slots init var total as float array with 50 slots init var cost_mi as float array with 50 slots init var file_name as string call func getFileName(pass file_name) create fstream object data_file use data_file object to open file_name if data_file is opened successfully call func readData(data_file, pick_up_loc, drop_off_loc, pass_count, trip, distance, fare_amount, toll_amount, total, cost_mi) else if data_file is not opened successfully print "Trouble opening " + file_name def func getFileName(parameter name as string pass by reference) print "Enter the name of the file including extension" take input and store it in name def func readData(fstream& file, int pick[], int drop[], int passenger[], int trip[], float distance[], float fare[], float toll[], float total[], float cost_mi[]) init var counter set it to 0 take first line of data from file and store it in the correct array corresponding to its position total[counter] = fare[counter] + toll[counter] trip[counter] = counter + 1 if distance[counter] == 0 cost_mi[counter] = 0 else cost_mi[counter] = fare[counter] / distance[counter] while not at end of file add 1 to counter take current line of data from file and store it in the correct array corresponding to its position trip[counter] = counter + 1 total[counter] = fare[counter] + toll[counter] if current distance = 0 cost_mi[counter] = 0 else cost_mi[counter] = fare[counter] / distance[counter] close data_file call func displayData(trip, pick, drop, passenger, distance, fare, toll, total, cost_mi, counter) def func displayData(int trip[], int pick[], int drop[], int passenger[], float distance[], float fare[], float toll[], float total[], float cost_mi[], int counter) init var total_people as int, set it to 0 init var total_cost as float, set it to 0 init var width as int, set it to 50 display with width "Trip #, Pick Up, Drop off, # of ppl, distance, fare, toll, total, cost/mile" for int idx = 0, idx <= counter, idx++ display with width and fixed precision set to 2, trip + pick, drop, passenger, distance, fare, toll, total, cost_mi total_people = total_people + passenger[idx] total_cost = total_cost + fare[idx] + toll[idx] display "People transported" + total_people display "Total paid" + total_cost display "Average cost per person" total_cost / total_people