Join 136,569 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,917 people online right now. Registration is fast and FREE... Join Now!
I need to write a program that provides for the storage and retrieval of a set of objects (records) for email addresses and websites. Each object must have a data element for: the name of the person (or company), the email address, and the website. The program must have a user interface that allows the following operations:
1. Add: Adds a new object for a person's or a company's data 2. Delete: Delete a given person's object 3. Change: Allows the editing of the information in an object 4. Find: Search for a specific object in the list of objects. 5. Quit: Exit from the application.
Design and implement a class to store data about each entry. Name this class EMailObjs. This class should have appropriate data elements for storing a name, email address, and website URL. Provide for access methods for setting and retrieving data.
Design and implement a class to store a collection of email elements (EMailObjs). Name this class EMailList. An element of this object will be a collection of EMailObjs implemented through the use of one of the data structures in the STL. Provide appropriate member functions to manage this collection of data.
The EMailList should have member functions to save and restore data to a text file. Data should be read from a file when the program starts and save data to a file when it terminates.
The user interface should also be implemented as a class with appropriate member functions for each of the required operations. Name this class UserInterface.
This program must use: file streams, exception handling, object oriented technology, class templates and the STL. It should also use, where appropriate, operator overloading and friend functions.
I already started one of the functions. Still working functions add, find, change and quit.
and also I use char instead of string. is that acceptable?
I need to write a program that provides for the storage and retrieval of a set of objects (records) for email addresses and websites. Each object must have a data element for: the name of the person (or company), the email address, and the website. The program must have a user interface that allows the following operations:
1. Add: Adds a new object for a person's or a company's data 2. Delete: Delete a given person's object 3. Change: Allows the editing of the information in an object 4. Find: Search for a specific object in the list of objects. 5. Quit: Exit from the application.
Design and implement a class to store data about each entry. Name this class EMailObjs. This class should have appropriate data elements for storing a name, email address, and website URL. Provide for access methods for setting and retrieving data.
Design and implement a class to store a collection of email elements (EMailObjs). Name this class EMailList. An element of this object will be a collection of EMailObjs implemented through the use of one of the data structures in the STL. Provide appropriate member functions to manage this collection of data.
The EMailList should have member functions to save and restore data to a text file. Data should be read from a file when the program starts and save data to a file when it terminates.
The user interface should also be implemented as a class with appropriate member functions for each of the required operations. Name this class UserInterface.
This program must use: file streams, exception handling, object oriented technology, class templates and the STL. It should also use, where appropriate, operator overloading and friend functions.
I already started one of the functions. Still working functions add, find, change and quit.
and also I use char instead of string. is that acceptable?
And also I am not sure how can I use all this criteria together: file streams, exception handling, object oriented technology, class templates and the STL. It should also use, where appropriate, operator overloading and friend functions.
yes and no... yes you can use char's but your going to make it alot more work and you will have to use char arrays ( char name[SIZE] ) as of right now you can only hold 1 character
QUOTE(kaantexas @ 5 May, 2008 - 05:05 PM)
And also I am not sure how can I use all this criteria together: file streams, exception handling, object oriented technology, class templates and the STL. It should also use, where appropriate, operator overloading and friend functions.
file streams -> store all the data in them exception handling -> the main thing i would use this for is error handling with opening / read / write to the file oop -> make an object something like mailingList and have name,email,website as the data stl -> your data in the mailingList object (name,email,website) could be vectors (a.k.a kick ass array class) overloading -> overload the ostream operator to make it easy to print / save the data, this could also be your friend function
this is a start of the class i was talking about... this is just how i would do it i know there are other ways but this should help you get a better idea
yes and no... yes you can use char's but your going to make it alot more work and you will have to use char arrays ( char name[SIZE] ) as of right now you can only hold 1 character
QUOTE(kaantexas @ 5 May, 2008 - 05:05 PM)
And also I am not sure how can I use all this criteria together: file streams, exception handling, object oriented technology, class templates and the STL. It should also use, where appropriate, operator overloading and friend functions.
file streams -> store all the data in them exception handling -> the main thing i would use this for is error handling with opening / read / write to the file oop -> make an object something like mailingList and have name,email,website as the data stl -> your data in the mailingList object (name,email,website) could be vectors (a.k.a kick ass array class) overloading -> overload the ostream operator to make it easy to print / save the data, this could also be your friend function
this is a start of the class i was talking about... this is just how i would do it i know there are other ways but this should help you get a better idea
I created .h file with friend function and vector function. Do you think I should get another .h file or keep everything in .cpp file? And also this is the .cpp file and I am not sure how I can use "vector" and "friend function" in here...
yes and no... yes you can use char's but your going to make it alot more work and you will have to use char arrays ( char name[SIZE] ) as of right now you can only hold 1 character
QUOTE(kaantexas @ 5 May, 2008 - 05:05 PM)
And also I am not sure how can I use all this criteria together: file streams, exception handling, object oriented technology, class templates and the STL. It should also use, where appropriate, operator overloading and friend functions.
file streams -> store all the data in them exception handling -> the main thing i would use this for is error handling with opening / read / write to the file oop -> make an object something like mailingList and have name,email,website as the data stl -> your data in the mailingList object (name,email,website) could be vectors (a.k.a kick ass array class) overloading -> overload the ostream operator to make it easy to print / save the data, this could also be your friend function
this is a start of the class i was talking about... this is just how i would do it i know there are other ways but this should help you get a better idea
I did without using object oriented technology, class templates and the STL. I should also use, where appropriate, operator overloading and friend functions.
And also Delete and Find function dont work.
#include <fstream> #include <iostream> using namespace std;
/* globals */ const int FIRST_NAME = 15; const int LAST_NAME = 15; const int E_MAIL = 30; const int WEBSITE = 20;