Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ flashdrive_driver FlashDrive C++ flashdrive_driver Sample Driver Code void m

ID: 3593297 • Letter: C

Question

C++ flashdrive_driver

FlashDrive

C++ flashdrive_driver

Sample Driver Code

void main( )
{
int i;
cout << "Welcome to Howie's Flash USB Drive Store!"
       << endl;
cout << "How much memory do you need? ";
cin >> i;

FlashDrive f( i, 0,

false );
cout << "Let's format the drive..." << endl;
f.formatDrive();
cout << "Let's plug in the drive..." << endl;
f.plugIn();
cout << "Let's write some data..." << endl;
f.writeData( 10 );
cout << "Let's unplug the drive..." << endl;
f.pullOut();

cout << "Enjoy your drive!!" << endl;
}

FlashDrive

FlashDrive( );
FlashDrive( int capacity, int used, bool pluggedIn ); void plugIn( );
void pullOut( );
void writeData( int amount );
void eraseData( int amount );
void formatDrive( ); int getCapacity( );
void setCapacity( int amount ); int getUsed( );
void setUsed( int amount ); bool isPluggedIn( ); int my_StorageCapacity;
int my_StorageUsed;
bool my_IsPluggedIn; part b: flashdrive_driver I have provided you with a sample class named FlashDrive which has been diagrammed below and described in the online course content. For this unit, I'd like you to identify additional member variables (data) that would be appropriate for the class FlashDrive. I would also like you to identify additional methods (functions) that would be appropriate for the class FlashDrive. Submit a .h file for FlashDrive with the new possible methods and members you have identified commented and explained. FlashDrive mple Driver Code include lashDrive LashDrive( int capacity, int used, bool pluggedin ) #include "PlashDrive.h" oid main) oid plugIn( )i oid pullOut oid writeDataint amount oid eraseData int amount oid formatDrivel int ii cout

Explanation / Answer

class FlashDrive
{
    public:
        FlashDrive();   //A default constructor.
        FlashDrive(int caparcity, int used, bool pluggedIn);   //Parameterized constructor.
       
        void plugIn();   //Plugs-in the drive, i.e., sets my_IsPluggedIn to true.
        void pullOut();   //Pulls-out the drive, i.e., sets my_IsPluggedIn to false.
        void writeData(int amount);   //Writes an amount of data to drive.
        void eraseData(int amount);   //Removes an amount of data from drive.
        void formatDrive();   //Removes all data from drive.
       
        int getUsed();   //Gets the amount of data used.
        void setUsed(int amount);   //Sets the amount of data used.
       
        int getCapacity();   //Gets the capacity of drive.
        void setCapacity();   //Sets the capacity of the drive.
       
        bool isFull();   //Checks if the drive is readily full, and cannot be written.
        bool isEmpty();   //Checks if the drive is empty, and cannot be erased further.
        bool isPluggedIn();   //Checks if drive is plugged in or not.
    private:
        int my_StorageCapacity;
        int my_StorageUsed;
        bool my_IsPluggedIn;  
};

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote