Menu

[Solved]Given Document Class Write Basic Version Google Drive Program Store Two Lists Documents On Q37134829

Given the Document class below, you will write a basic versionof Google Drive. Your program will store two lists of documents,one for documents the user has created and one for createddocuments the user has shared with a friend. The user will have afew options which you will need to implement (note: the menu willonly be displayed once at the beginning of the program):

Add a document to the user’s list:
Allow the user to enter the document name, document extension, anddocument contents and then add that Document to the list ofdocuments

Rename one of the user’s documents
Allow the user to enter the index of the document in their listthey want to rename
Allow the user to enter the updated name of that document
Set the name of the document to be the updated name they enter

Share one of the user’s documents with a friend
Allow the user to enter the index of their document they want toshare with their friend

Display all the documents in both the user’s and the friend’slist.
Print all the information about all the documents in the user’slist
Print all the information about all the documents in the friend’slist

Full Example Input/Output:

Choose an option below:
1. Add a document to your list
2. Rename one of your documents
3. Share one of your documents with your friend
4. Display all of the documents
5. Quit
1

Enter the document name:
MainLab1
Enter the document extension:
cpp
Enter the document content:
#include ….

Enter option:
1
Enter the document name:
REL_A_131_Paper
Enter the document extension:
doc
Enter the document content:
In the Book of Mormon, one of the main…

Enter option:
1
Enter the document name:
American-Heritage-Study-Guide
Enter the document extension:
doc
Enter the document content:
The Spanish Armada was a…

Enter option:
1
Enter the document name:
Physical_Science_100
Enter the document extension:
ppt
Enter the document content:
Slides for Physical Science Presentation…

Enter option:
4
——————-Your List——————
Name: MainLab1.cpp
Contents: #include ….
Name: REL_A_131_Paper.doc
Contents: In the Book of Mormon, one of the main…
Name: American-Heritage-Study-Guide.doc
Contents: The Spanish Armada was a…
Name: Physical_Science_100.ppt
Contents: Slides for Physical Science Presentation…
————–Your Friend’s List————–
——————————————–

Enter option:
3
Enter the index of your document you want to share:
2

Enter option:
4
——————-Your List——————
Name: MainLab1.cpp
Contents: #include ….
Name: REL_A_131_Paper.doc
Contents: In the Book of Mormon, one of the main…
Name: American-Heritage-Study-Guide.doc
Contents: The Spanish Armada was a…
Name: Physical_Science_100.ppt
Contents: Slides for Physical Science Presentation…
————–Your Friend’s List————–
Name: American-Heritage-Study-Guide.doc
Contents: The Spanish Armada was a…
——————————————–

Enter option:
2
Enter the index of your document you want to rename:
2
Enter the updated name of the document:
American-Heritage-Final-Study-Guide

Enter option:
4
——————-Your List——————
Name: MainLab1.cpp
Contents: #include ….
Name: REL_A_131_Paper.doc
Contents: In the Book of Mormon, one of the main…
Name: American-Heritage-Final-Study-Guide.doc
Contents: The Spanish Armada was a…
Name: Physical_Science_100.ppt
Contents: Slides for Physical Science Presentation…
————–Your Friend’s List————–
Name: American-Heritage-Final-Study-Guide.doc
Contents: The Spanish Armada was a…
——————————————–

Enter option:
5

This is what has been given to us:

#include <iostream>
#include <string>
#include <vector>

using namespace std;

//Document.h
class Document{
private:
string name;
string extension;
string contents;
public:
Document(string nameIn, string extensionIn, stringcontentsIn);
string GetName();
void Rename(string newDocumentName);
string GetExtension();
string GetContents();
void Print();

};

//Document.cpp
Document::Document(string nameIn, string extensionIn, stringcontentsIn){
name = nameIn;
extension = extensionIn;
contents = contentsIn;
}
string Document::GetName(){
return name;
}
void Document::Rename(string newDocumentName){
name = newDocumentName;
}
string Document::GetExtension(){
return extension;
}
string Document::GetContents(){
return contents;
}
void Document::Print(){
cout << “Name: ” << name << “.” <<extension << endl;
cout << “Contents: ” << contents << endl;
}

//main.cpp———-
void DisplayMenu(){
cout << “Choose an option below: “<< endl;
cout << “1. Add a document to your list”<< endl;
cout << “2. Rename one of your documents”<< endl;
cout << “3. Share one of your documents with yourfriend”<< endl;
cout << “4. Display all of the documents”<< endl;
cout << “5. Quit”<< endl << endl;
}

int main(){
const int ADD_DOCUMENT_OPTION = 1;
const int RENAME_DOCUMENT_OPTION = 2;
const int SHARE_YOUR_DOCUMENT_OPTION = 3;
const int DISPLAY_ALL_DOCUMENTS_OPTION = 4;
const int QUIT_OPTION = 5;

int option;
DisplayMenu();
cin >> option;

while(option != QUIT_OPTION){
  
if(option == ADD_DOCUMENT_OPTION){
cout << “Enter the document name: ” << endl;
}
else if(option == RENAME_DOCUMENT_OPTION){

}
else if(option == SHARE_YOUR_DOCUMENT_OPTION){

}
else if(option == DISPLAY_ALL_DOCUMENTS_OPTION){

}
  
cout << endl << “Enter option: ” << endl;
cin >> option;
}
return 0;
}

Expert Answer


Answer to Given the Document class below, you will write a basic version of Google Drive. Your program will store two lists of doc… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *