C++ record_player flashdrive Following the class diagram shown below, create the
ID: 3597731 • Letter: C
Question
C++ record_player flashdrive
Following the class diagram shown below, create the class RecordPlayer. An RecordPlayer represents a stereocomponent that can play vinyl records.. Please review the class and the sample driver code. As explained in class, there is a specific order to the way the class methods should be called. In other words, you can't plop the Needle unless there actually is a record on the player and the recordplayer is turned on. You also can't return the Needle unless there is actually a record on the player and the recordplayer is turned on. Your class should enforce these rules and write errors to cout as they occur. A sample driver for this class is shown below. You should probably make a more thorough driver to test your class better.
Your submission should follow this organization:
main.cpp this is your driver file
record_player.h
record_player.cpp
RecordPlayer
void turnOn( );
void turnOff( );
bool isPoweredOn( );
void affixPlatter( string record );
void plopNeedle( );
void returnNeedle( );
Sample Driver Code
RecordPlayer r;
r.turnOn();
r.affixPlatter( "Barry Manilow I" );
r.plopNeedle( );
r.returnNeedle( );
r.turnOff( );
cout << "--Test 2--" << endl;
RecordPlayer badr;
badr.plopNeedle( );
cout << "--Test 3--" << endl;
RecordPlayer badr1;
badr1.turnOn( );
badr1.plopNeedle( );
cout << "--Test 4--" << endl;
RecordPlayer badr2;
badr2.returnNeedle( );
cout << "--Test 5--" << endl;
RecordPlayer badr3;
badr3.turnOn( );
badr3.returnNeedle( );
Sample Driver Output
RecordPlayer
RecordPlayer( );void turnOn( );
void turnOff( );
bool isPoweredOn( );
void affixPlatter( string record );
void plopNeedle( );
void returnNeedle( );
string my_Record;
bool my_NeedleIsOnTheRecord;
Sample Driver Code
cout << "--Test 1--" << endl;RecordPlayer r;
r.turnOn();
r.affixPlatter( "Barry Manilow I" );
r.plopNeedle( );
r.returnNeedle( );
r.turnOff( );
cout << "--Test 2--" << endl;
RecordPlayer badr;
badr.plopNeedle( );
cout << "--Test 3--" << endl;
RecordPlayer badr1;
badr1.turnOn( );
badr1.plopNeedle( );
cout << "--Test 4--" << endl;
RecordPlayer badr2;
badr2.returnNeedle( );
cout << "--Test 5--" << endl;
RecordPlayer badr3;
badr3.turnOn( );
badr3.returnNeedle( );
Sample Driver Output
--Test 1--recordplayer is on...
recordplayer has album Barry Manilow I
recordplayer is playing album Barry Manilow I
recordplayer has stopped playing album
recordplayer is off...
--Test 2--
you can't plop the needle without being powered on!
--Test 3--
you can't plop the needle without an album!
--Test 4--
you can't return the needle without being powered on!
--Test 5--
you can't return the needle without an album!
Explanation / Answer
* main.cpp * Corey Johns * COP4530 Fall 2012 * * Provides user interface. */ #include #include #include #include #include #include #include "wordweights.h" #define DEBUG 0 // Create the document map std::map docs; // Function prototypes void analyze(std::string); void read_file(std::string&, std::ifstream&); void query(std::string); int main(int argc, char** argv){ if ( argc < 2 ){ std::coutRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.