I have provided you with a sample class named FlashDrive which has been diagramm
ID: 3661948 • Letter: I
Question
I have provided you with a sample class named FlashDrive which has been diagrammed below. You can acquire the source to theFlashDrive class by clicking on the correct link for their development platform ( VS2010 VS2012 XCode5 XCode6 XCode7 ). 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. Update and resubmit the .h file forFlashDrive with the new possible methods and members you have identified commented and explained.
YOU ARE NOT REQUIRED TO CODE UP ANYTHING MORE THAN THE .H FILE CHANGES, ALTHOUGH YOU ARE WELCOME TO DO MORE THAN THIS IF YOU WISH.
Class Details
Sample Driver
FlashDrive
FlashDrive();
FlashDrive( int capacity, int size,bool pluggedIn );
void setCapacity( int amount );
int getCapacity( );
void setUsed( int amount );
int getUsed( );
bool isPluggedIn( );
void plugIn();
void pullOut();
void writeData( int amount );
void eraseData( int amount );
void formatDrive( );
int my_Size;
int my_Contents;
bool my_IsPluggedIn;
int 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;
return( 0 );
}
Class Details
Sample Driver
FlashDrive
FlashDrive();
FlashDrive( int capacity, int size,bool pluggedIn );
void setCapacity( int amount );
int getCapacity( );
void setUsed( int amount );
int getUsed( );
bool isPluggedIn( );
void plugIn();
void pullOut();
void writeData( int amount );
void eraseData( int amount );
void formatDrive( );
int my_Size;
int my_Contents;
bool my_IsPluggedIn;
#include "FlashDrive.h"
using namespace std;
int 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;
return( 0 );
}
Explanation / Answer
Flash Drive class can also contains following methods and variables(data):-
Void FlashDrive_Name();
String DriveName;
Void FlashDrive_FileSystem(); Examples: FAT32 and NTFS
String FileSystem;
Void FlashDrive_ReservedSpace();
int ReservedSpace;
Void FlashDrive_Policies();
Examples:- Optimize for quick removal, Optimize for performance
String Policies;
Void FlashDrive_PortSpecification();
Examples:- USB 0.8,USB 0.9,USB 0.99, USB 1.0,USB 1.1,USB 2.0 ,USB 3.0,USB 3.1
String PortSpecification;
Void FlashDrive_PowerSpecification();
Examples:- USB Battery-Charging 1.0,USB Battery-Charging 1.0,USB Battery-Charging 1.2,USB Power-Delivery 1 (v1.0),USB Type-C 1.0,USB Type-C 1.1,USB Power-Delivery 2 (v1.1)
String PowerSpecification;
Void FlashDrive_Classes();
Examples:-
Class Usage Description
01h Interface Audio
03h Interface Human interface device (HID)
05h Interface Physical Interface Device (PID)
String Classes;
Void FlashDrive_PowerStandards();
Examples:-
Specification Current Voltage Power
USB 1.x and 2.0 500mA 5V 2.5 W
USB 3.x 900mA 5V 4.5 W
USB Type-C 1.5 A 5V 7.5 W
Double Current;
Double Voltage;
Double Power;
I have defined many methods according to my understanding of the Flashdrive class you mentioned. Please choose which one is appropriate for you.
02h Both Communications and CDC Control