Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN C++ .For this question you will be creating a main function which will allow a user to interact with your program by providing their

IN C++ .For this question you will be creating a main function which will allow a user to interact with your program by providing their own target and input tunes. Your main function should present the user with a menu containing the following options:

Calculate the similarity between two tunes of the same length

Calculate the best similarity between two tunes of either equal or unequal length

Print three input tunes in order from most to least similar to the target tune

Exit

Your menu should run on a loop, continually offering the user each option until they choose to exit. Be sure to use the functions you wrote in questions 2 through 6.

Note: Your main function should account for any user input that isn't in valid SPN. If user input is not in valid SPN your program should print "Invalid input. Please enter a tune in valid SPN:" until the user enters valid SPN.

--- Sample Run 1--- (> indicates user input)

 

--- Menu --- 1. Calculate similarity between two tunes. 2. Calculate best similarity between two tunes of potentially different lengths. 3. Print three input tunes in order from most to least similar to the target tune. 4. Exit. Please enter your choice (1 - 4): > 6 Invalid input. --- Menu --- 1. Calculate similarity between two tunes. 2. Calculate best similarity between two tunes of potentially different lengths. 3. Print three input tunes in order from most to least similar to the target tune. 4. Exit. Please enter your choice (1 - 4): > 1 Please enter the first tune: > Hello! Invalid input. Please enter a tune in valid SPN: > A2F5G7B8 Please enter the second tune: > F2B5G1D2 The similarity score is: -0.75 --- Menu --- 1. Calculate similarity between two tunes. 2. Calculate best similarity between two tunes of potentially different lengths. 3. Print three input tunes in order from most to least similar to the target tune. 4. Exit. Please enter your choice (1 - 4): > 4 Goodbye!

--- Sample Run 2--- (> indicates user input)

 

--- Menu --- 1. Calculate similarity between two tunes. 2. Calculate best similarity between two tunes of potentially different lengths. 3. Print three input tunes in order from most to least similar to the target tune. 4. Exit. Please enter your choice (1 - 4): > 2 Please enter the input tune: > B3E1D7G4E1 Please enter the target tune: > E3G2D7 The best similarity score is: 0.33 --- Menu --- 1. Calculate similarity between two tunes. 2. Calculate best similarity between two tunes of potentially different lengths. 3. Print three input tunes in order from most to least similar to the target tune. 4. Exit. Please enter your choice (1 - 4): > 1 Please enter the first tune: > F4D1A0E9B6 Please enter the second tune: > E4F1D0 The similarity score is 0.00 --- Menu --- 1. Calculate similarity between two tunes. 2. Calculate best similarity between two tunes of potentially different lengths. 3. Print three input tunes in order from most to least similar to the target tune. 4. Exit. Please enter your choice (1 - 4): > 3 Please enter the first tune: > C0D9E3A5 Please enter the second tune: > D7E2A4F9G1 Please enter the third tune: > A8B1D4 Please enter the target tune: > B7D5 1) Tune 3, 2) Tune 1, 3) Tune 2 --- Menu --- 1. Calculate similarity between two tunes. 2. Calculate best similarity between two tunes of potentially different lengths. 3. Print three input tunes in order from most to least similar to the target tune. 4. Exit. Please enter your choice (1 - 4): > 4 Goodbye!

Be sure to paste only your main function into the answer box! A version of isValidNote, isValidTune, tuneSimilarity, bestSimilarity, and printWorstTune have already been provided for you.

For example:

Input Result
6 2 F5G7B1D4 A5G9B1 4
--- Menu --- 1. Calculate similarity between two tunes. 2. Calculate best similarity between two tunes of potentially different lengths. 3. Print three input tunes in order from most to least similar to the target tune. 4. Exit. Please enter your choice (1 - 4): Invalid Input. --- Menu --- 1. Calculate similarity between two tunes. 2. Calculate best similarity between two tunes of potentially different lengths. 3. Print three input tunes in order from most to least similar to the target tune. 4. Exit. Please enter your choice (1 - 4): Please enter the input tune: Please enter the target tune: The best similarity score is: 1.67 --- Menu --- 1. Calculate similarity between two tunes. 2. Calculate best similarity between two tunes of potentially different lengths. 3. Print three input tunes in order from most to least similar to the target tune. 4. Exit. Please enter your choice (1 - 4): Goodbye!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Shamkant B. Navathe

7th Edition Global Edition

1292097612, 978-1292097619

More Books

Students also viewed these Databases questions