Question
Write a function called isValidTune that will determine whether or not a given string of arbitrary length is composed of notes written exclusively in valid
Write a function called isValidTune that will determine whether or not a given string of arbitrary length is composed of notes written exclusively in valid SPN.
Function Specifications:
Name: isValidTune()
Parameters (Your function should accept these parameters IN THIS ORDER):
tune (string): The tune to be examined
Return Value: True is the tune is composed of valid notes, false otherwise (bool)
The function should make use of your isValidNote() function from question 1.
If the string is empty, then it should not be considered valid SPN and your function should return false.
The function should not print anything.
Paste only your isValidTune function in the answer box below! A version of isValidNote has been provided for you to call. Do not past any #includes or a main, those have already been created for you.
For example:
Test | Input | Result |
---|---|---|
//testing valid tune | A4B2E1D7 | 1 |
//testing invalid tune with even number of characters | M8D3R1 | 0 |
//test string with odd number of characters | G19 | 0 |
//test valid string | F9B0C1 | 1 |
//test invalid string that starts with valid notes | F6B4E | 0 |
// edge case - empty string | | 0 |
//test a string with valid notes in the middle | ACB4C300 | 0 |
// invalid input | csci1300 | 0 |
// valid tune | A5C3G8B2E8A3F7G2B2D8 | 1 |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started