Develop a model of the problem you are developing. This is different from flowch
ID: 3769345 • Letter: D
Question
Develop a model of the problem you are developing. This is different from flowcharting. Make sure the model reflects the problem statement. You then need to develop a C++ program to solve the problem stated. Below is a typical problem statement expected for the assignment.
Define two classes with appropriate data members and member functions. Class Name is defined to handle the user first name and the last name. As a minimum, the class will have one string data member in the private access region of the class, a default constructor, and other accessor and mutating member functions in the public access region of the class. The class File is defined to handle the file names for input, output, and input/output purposes. As a minimum, the class will have one string data member in the private access region of the class, a default constructor, and other accessor and mutating member functions in the public access region of the class. Here is how the program will operate.
Upon execution of the program, an object of the class Name is created and its data member is set to your first name via the class constructor (there are different ways this can be done). Another object of this class is defined and obtains your last name from the keyboard and sets your last name (this can be a constructor or a mutating function). The program will then display your full name using the function displayName() to display your full name in the format shown below.
Firstname Lastname
The class Name provides for accepting the first name and the last name as needed by the program.
Once the first name and last name are displayed, the program prepares to write the first name and last name into a file. The program creates objects of the class File as explained here. The first object, sets the data member of the class to the file name associated with the first name via the class constructor, writes the first name to the file, and closes the file. The user is then prompted for the name of the file for writing the last name to the file. Once the last name is written to the file, the file is closed. The program will then open the two files and writes their contents to the screen in the format shown below.
First name
Last name
The program will then create a file object, gets the file name (for the full name) from the user, and writes the first name from the file that has the first name, and the last name from the file that has the last name and closes the files. The next step is for the program to prompt the user to read the contents of the file that has the full name. If the user entered yes, the program will display the full name in the format shown below.
Firstname Lastname
and closes the file. If the user entered no, the program proceeds to the next step.
The user is then prompted to try other user names and file names and repeats the process explained above.
Other member functions for the two classes are defined by the programmer and as a minimum will include constructors, destructors, accessor, and mutating functions. User-defined functions will be used as needed to solve your problem.
This program leaves out a few options for you to select. For example, writing first name, last name, and full name to their respective files and then retrieving them from these file and displaying them.
Notes:(please read very carefully)
1. Make sure your media is VIRUS FREE
2. Comment your program.
3. Use meaningful prompts.
4. Provide a detailed description of the problem you are solving.
5. Be sure to include a header file at the beginning of your program as shown in the course syllabus.
6. NO global declarations allowed, except for the function prototypes and class declarations.
7. Use classes, member functions, files, and strings.
8. Full member -function prototyping is required. Member functions must have their purposes fully explained.
8A. No member function should be defined within a class (i.e., no body of a member function should be seen inside any of the classes you are defining)
9. Make sure to use constructors and destructors for the classes. A class may have more than one constructor.
10. Parameter passing to the user-defined functions, the class member functions and the return types will be specified by you. The function prototypes will clearly show the formal parameters and the return values.
11. Use data types as specified in the member function prototypes. All class data members will be in the private access region of the class.
13. Use Microsoft Visual C++ .NET 2010 compiler using default compiler settings.
14. Use Microsoft Visio 2013 to develop your model.
15. Adherence to the ANSI C and ANSI C++ required.
16. Do not use <stdio.h> and <conio.h>
17. Do not use any #define in your program
18. No goto statements allowed in any program that you develop in this course.
Explanation / Answer
Model:
Sample code:
Fiile.cpp:
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.