I have an array of objects and I am using this array in 3 separate function calls: totalJars, highest, and lowest. Everything compiles without error, but I am having problems with 2 of the functions. The totalJars function works correctly, but I can't get the highest and lowest functions to work. As the code is currently written, the highest function returns a '-', and the lowest function doesn't return anything at all. If someone could tell me what I am missing I would greatly appreciate it.
highest and lowest are defined to return int. However, you are trying to put the result in string variables.
Declare highestSales and lowestSales to be int, not string.
lowest() is also wrongly coded. Initialise low with the first value.