Question: Write a function called printTuneRankings that accepts three input tunes and one target tune, and prints the input tunes in order from most to least
Write a function called printTuneRankings that accepts three input tunes and one target tune, and prints the input tunes in order from most to least similar to the target. The tunes should be ranked in order of each tune's best similarity score (from question 5). It is not necessary for the three input tunes to be the same length.
Function Specifications:
The function name: printTuneRankings
Parameters (Your function should accept these parameters IN THIS ORDER):
string tune1: The first input tune to be checked against the target
string tune2: The second input tune to be checked against the target
string tune3: The third input tune to be checked against the target
string target_tune: The target tune
Return Value: No Return Value.
Output:
Your function should print the list of tunes based on their similarity score against the target tune.
The output format should match the example below exactly, with each tune preceded by its ranking and a closing parenthesis.
If any of the tunes are tied in similarity, your function should rank them in the order in which they were passed to the function.
Remember that the three input tunes need not be of the same length.
This function should make use of the bestSimilarity function created in question 5.
You may assume that any parameters passed to your function will always be in valid SPN.
--- Examples ---
| Sample function call | Expected output (printed to screen) |
|---|---|
| printTuneRankings("D3D4", "E3D4", "D3F4", "A7") | 1) Tune 1 2) Tune 2 3) Tune 3 |
| printTuneRankings("C2E7", "D4B3", "A4D1", "A4B7") | 1) Tune 2 2) Tune 3 3) Tune 1 |
| printTuneRankings("B8", "C8", "A7", "C8") | 1) Tune 2 2) Tune 1 3) Tune 3 |
| printTuneRankings("C2E7", "D4", "A4D1", "A4B7") | 1) Tune 3 2) Tune 2 3) Tune 1 |
| printTuneRankings("F4B2E6", "A1", "B6G2E4", "B7G4") | 1) Tune 3 2) Tune 2 3) Tune 1 |
Your file should be named printTuneRankings.cpp and should also include your tuneSimilarity and bestSimilarity functions along with a main function that tests your new printTuneRankings function. Once you have finished developing your solution in VSCode you should head over to the CodeRunner on Canvas and paste only your printTuneRankings function into the answer box for question 6. You do not need to paste your main function into Coderunner. A main function has already been provided for you. You will need to include your main, printTuneRankings and any other helper functions in the printTuneRankings.cpp file that you submit to Canvas.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
