Question: Create a class named Piano (C++). The class has the following methods: 1-) LoadNotes. This function takes a string as a parameter, the parameter is
Create a class named Piano (C++). The class has the following methods:
1-) LoadNotes. This function takes a string as a parameter, the parameter is a file name that contains notes. The notes are already shown in the code you're given. Load Notes should read the notes into an array of characters (or strings)
2-) PlayNotes. This function simply plays the notes that were loaded by LoadNotes.
So to test your Piano class, I simply need to do this in main:
void main()
{
Piano mypiano;
mypiano.LoadNotes("c:\\temp\\input.txt");
mypiano.PlayNotes();
}
Submit a complete class, make sure it's commented, you can have any other functions in it, and any attributes you want.
Use the code below for your assignment. Just put it in a class to meet the assignment requirement.
#include#include #include #include using namespace std; int main(int argc, char *argv[]) { while(true){ cout<<"Input note: "; char note = getch(); //do re mi fa sol la si do re mi fa sol if(note == 'a'){ Beep(261,100); } if(note == 's'){ Beep(293,100); } if(note == 'd'){ Beep(329,100); } if(note == 'f'){ Beep(349,100); } if(note == 'g'){ Beep(392,100); } if(note == 'h'){ Beep(440,100); } if(note == 'j'){ Beep(493,100); } if(note == 'k'){ Beep(523,100); } if(note == 'l'){ Beep(587,100); } if(note == ';'){ Beep(659,100); } if(note == '\''){ Beep(698,100); } if(note == '\\'){ Beep(784,100); } //rebemol mibemol solbemol labemol sibemol rebemol mibemol solbemol if(note == 'w'){ Beep(277,100); } if(note == 'e'){ Beep(311,100); } if(note == 't'){ Beep(370,100); } if(note == 'y'){ Beep(415,100); } if(note == 'u'){ Beep(466,100); } if(note == 'o'){ Beep(554,100); } if(note == 'p'){ Beep(622,100); } if(note == ']'){ Beep(740,100); } system("cls"); } return EXIT_SUCCESS; }
I AM AWARE THERE IS AN ANSWER OUT THERE PROVIDE BY THE BOOK BUT I AM HOPING FOR AN EXAMPLE THAT IS DIFFERENT SO I CAN COMPARE THE DIFFERENT ROUTES TAKEN WHEN ASKED THIS PROBLEM! THANK YOU!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
