Hello. I'm required to sort two parallel arrays, first one regnum[] which is of type string and the other array extraWeightOverload[] which is of type doublet.
Now the following method must receive both arrays as input parameters. The method must sort the arrays in descending order using the extraWeightOverload as the sorting criteria
Find the method header below. Though this talks about composition between Class truck and class WeighBridge.
How big are these arrays? Normally you'd pass the size as a parameter.
Have you learned how to sort an array? If so then write the code to sort extraWeightOverload. Once it's done, add code so that any time you move elements of extraWeightOverload, you also move the corresponding items of regNum.
If you haven't learned a way to sort yet, then think about how you'd do it by hand. One way is to find the largest item and put it first. Then find the next largest item and put it second, etc. The only trick to translating this to code is that when you "put it first", you can actually SWAP the items. So the algorithm is "find the largest item and swap it with the first one. Then find the largest of the remaining items and swap it with the second, etc.
Could we ask you nicely to have only one Topic for the same code? All of your posts so far have been about the WeighBridge and some of those have been duplicates.
I know you are asking different questions, but it is easier if all those questions are grouped into one Topic. It doesn't matter if there are 10 pages worth of posts on the same Topic, I for one would prefer that than dozens of separate Topics.
I'm sorry. It's my first time using this platform.
My million apologies.
Is it possible for me to upload a file I've been working on and the PDF problem statement along with it in a zip folder?
I have debugged the program/app but it keeps on breaking. I really need your help more on the solution and I'm so grateful for all your help thus far.
Basically, my program is about creating a program that will manage trucks that use a weighing bridge on a National road, to check on the load they have on and if it passes the Max limit of a truck's carrying capacity, it must fine that particular truck.
So how can I upload the solution I've worked on so far so that you help me because if I know how to handle such a program with composition, I will ace my exam be more confident in doing inheritance with pointers and dynamic memory.