Parallel Arrays are two arrays, often containing elements of different datatypes that are synced with a common index. For this problem you are going to create a function called FindHighest that will accept two parameters: names and calls. The names list will contain the names of individuals that work on a help desk. The calls list will contain the number of calls they received in one day. Your function will return back to main the name of the person who received the highest number of calls along with the number of calls they received.
In a prior problem, you wrote code that returned the index of where the highest value in that list was found. In another problem you returned the lowest value found in a list. This problem is very similar to the two you already solved in that you will not only be associating the index of where you found the highest value but also the value itself. Remember that when working with Parallel Arrays or Lists, the lists are synced with a common index. Therefore if you found the lowest value at index 3, that would correspond to index 3 in the other list.
For example given that we have the list names and calls with the following values:
names = ["Bob", "Mary", "Sue", "John", "Mike", "Becky"] calls = [20, 11, 15, 32, 17, 28]
We know that the highest number in calls is 32. That value corresponds to John because John is at index value 3. This means we can write:
highest_calls = 32 highest_name = names[3]
As with the other problems in this unit, the best way to start coding is to open VS Code or IDLE and write your function. You can use the following code to test your function:
def main():
#variables
names = ["Bob", "Mary", "Sue", "John", "Mike", "Becky"]
calls = [20, 11, 15, 32, 17, 28]
highest_name = str()
highest_calls = int()
highest_name, highest_calls = FindHighest(names, calls)
print(highest_name, "\t", highest_calls)
main()
If you run your code using the above to test, if your code is working it should print out:
John 32
If you see this output it is safe to move your function code only to Codio for further testing. Codio will test your program by calling your function. It will use two different sets of testing data. Both sets have different names and calls and a different number of names and calls. This means that when you solve this problem, your loop examining the calls list, needs to accommodate for lists of different sizes. (HINT: use the len() function.)
def FindHighest(names, calls):
maxIndex = 0
for i in range(1,len(calls)):
if calls[maxIndex] < calls[i]:
maxIndex = i
return names[maxIndex], calls[maxIndex]
def main():
#variables
names = ["Bob", "Mary", "Sue", "John", "Mike", "Becky"]
calls = [20, 11, 15, 32, 17, 28]
highest_name = str()
highest_calls = int()
highest_name, highest_calls = FindHighest(names, calls)
print(highest_name, "\t", highest_calls)
main()


Parallel Arrays are two arrays, often containing elements of different datatypes that are synced with a...
This lab is to give you more experience with C++ Searching and Sorting Arrays Given a file with data for names and marks you will read them into two arrays You will then display the data, do a linear search and report if found, sort the data, do a binary search. Be sure to test for found and not found in your main program. Read Data Write a function that reads in data from a file using the prototype below....
Define a function called DisplayMax that has 3 parameters: the first two parameters are parallel arrays of different types and the third argument is of type size_t representing the size of both arrays. The function DisplayMax must work when called with various types of actual arguments, for example string DisplayMax(string names[], int calories[], int size) or int DisplayMax(int calories[], float prices[], int size). (Parallel Arrays are two arrays whose data is related by a common index. For example: with the...
C++ Please Contact list - functions & parallel arrays/CStrings No Vectors can be used since we haven't learned them yet !! A contact list is a place where you can store a specific information with other associated information such as a phone number, email address, birthday, etc. Write a program that will read 5 data pairs into two parallel arrays. Data pairs consist of a name (as a CString) and a GPA (double). That list is followed by a name,...
Write a main function that declares the names, marks, number of elements as well as the value to be searched for and the index of the returned function calls. Read and display the contents of names and marks. Ask the user for a name and using the linear search return the index to the user. If -1 is returned then the name is not in the file. Otherwise write out the name and mark for that student. Sort the arrays...
Define an ordinary function called DisplayMin that has three parameters: the first two parameters are parallel arrays of different types and the third argument is of type size_t representing the size of both arrays. The function DisplayMin must work when called with various types of actual arguments, for example string DisplayMin(string names[], int calories[], int size) or int DisplayMin(int calories[], float prices[], int size). (Parallel Arrays are two arrays whose data is related by a common index. For example: with...
Python: Arrays and Lists (do code on repl.it)
Part C (4 points) - more advanced lists You will need a Python repl to solve part C. In Python, define a function named secondHighest which accepts a list of numbers, and returns the second highest number from the list. If the highest value occurs more than once, then it is also the second highest (see example). Assume the input list will always have length at least two (so there is always...
In this module, you learned about Arrays in C++ and how to implement arrays within your C++ programs. For this assignment, you will implement your knowledge of arrays for Michigan Popcorn Company’s sales management system. Write a program that lets the Michigan Popcorn Company keep track of their sales for seven different types of popcorn they produce: plain, butter, caramel, cheese, chocolate, turtle and zebra. It should use two parallel seven-element arrays: an array of strings that holds the seven...
guys need help please im super lost anyone save me do programming exercise top_div_array.cpp: Winning Division app (top_div.cpp) revisited to use arrays This is the same program done last week but using and passing arrays instead of individual variables. Start with the following file / cODE BELOW: // Name: top_div_array.cpp // Description: // This app inputs sales for four regional division and displays the highest. // To accomplish this, use two arrays of equal length - one for sales and...
Array lists are objects that, like arrays, provide you the ability to store items sequentially and recall items by index. Working with array lists involves invoking ArrayList methods, so we will need to develop some basic skills. Let's start with the code below: The main method imports java.utii.ArrayList and creates an ArrayList that can hold strings by using the new command along with the ArrayList default constructor. It also prints out the ArrayList and, when it does, we see that...
5 5 - Parallel Arrays in Python Mind Tap - Cengage Lea x + V A https//ng.cengage.com/static/nb/ui/evo/index.html?deploymentid=5745322406056533358933471518eISBN=9781337274509&id=586434 145&snapshotld: L x ... € → O 1 » CENGAGE MINDTAP Q Search this course x Parallel Arrays in Python D Parallel Lists Jumpinjive.py + > Terminal + 1 # Jumpin Java.py - This program looks up and prints the names and prices of coffee orders. 2 # Input: Interactive 3 # Output: Name and price of coffee orders or error message if...