It is very important that you read the notes at the end of each assignment for t
ID: 3816990 • Letter: I
Question
It is very important that you read the notes at the end of each assignment for this and all other assignments.
Make sure that you read related lessons, slides, the notes, and the sample programs. Study the exercises, and study program examples in the book. These are all prerequisites for better understanding of the classes, objects, and messages.
This assignment covers classes, and strings (refer to chapters 10, 11, 12, and 14 in the assigned text and the related sample programs and the notes discussed in the class). Enough flexibility are provided for you to apply your knowledge of the basic C++ programing to develop a solution with enough information and documentation as needed for this assignment.
Develop a model of the problem you are developing. This is different from the flowcharting you have been doing throughout the semester. Make sure the model reflects the problem statement. You then need to develop a C++ program to solve the problem stated by you.
Define a class Name with appropriate data member(s) and member functions (at least constructors and a destructor for each class.)
Define the class First derived from the class Name that will create your first name with appropriate data member(s) and member functions (at least constructors and destructor for each class.)
Define the class Last derived from the class Name that will create your last name with appropriate data member(s) and member functions (at least constructors and destructor for each class.)
You will create an object of the class First and an object of the class Last using the default constructors and constructors with arguments.
The default constructors initialize the two objects F1 and L1. An overloaded constructors will obtain the first name and the last name from the keyboard and create objects F2 and L2.
The program will then display your full name using the function displayName() to display your full name in the format shown below.
Firstname Lastname
Once the first name and last name are displayed, the program ends.
Other member functions for the 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.
C:UsersshivnDesktopH7 ELET 2300-03 Spring 2017.docxx, FA: 04/04/2017 Spring 2017, H7 - 1
Notes:(please read very carefully)
Grading:
Program model
Choice of data selected Documentation
Proper development of classes, and member functions Program completeness
Sample correct outputs
10 points
5 points
10 points – problem statement, class, member functions, main(), etc.
35 points
10 points, this includes program correctness, efficient programming, using right constructs for the solution, and proper use of coding as emphasized in class
10 points
Notes:(please read very carefully)
1. Make sure your files are VIRUS FREE! (A grade of 0 will be given for infected files). Use Technology lab PCs for the test. 2. Comment your program.
3. Use meaningful prompts.
3a. You need to review “how to submit your homework” document. Incomplete submissions will not be graded.
4. Provide a brief description of the problem being solved.
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, 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.
12. On the due date, submit your H7 containing the components of the program specified in the guidelines. Create a Word file that contains the header, the flowchart, the list of your .cpp file, and the sample runs of the program. Name this file H7NAME.docx. The source file for H7NAME.cpp and the Visio 2013 file H7NAME.vsdx will be uploaded as well. Unrelated files should not be present when you upload them to the Blackboard. Homework must be uploaded to Blackboard before 9PM of the due date. NAME is your last name.
13. Use Microsoft Visual Studio Enterprise 2015 compiler using default compiler settings.
14. Use Microsoft Visio 2013 to develop your flowchart.
15. Illegal inputs must be handled properly without terminating the program.
16. Adherence to the ANSI C++ required.
17. Do not use <stdio.h> and <conio.h> in this assignment and all other assignments.
18. Do not use any #define in your program until the time that is required for class declaration header files. 19. No goto statements allowed in any program that you develop in this course.
20. Non-compliance with these notes will cost you points.
21. No collaboration on this assignment and all other assignments allowed. If you violate this policy, your grade for the course will be F.
22. You need to show us your program model/flowchart before we can help you with your code.
23. When copying and pasting code into a Word document, please use the Courier New font with a font size no more than 10. 24. Late homework will not be accepted.
25. When copying and pasting code into a Word document, please use the Courier New font with a font size no more than 10.
Explanation / Answer
Program
--------------------
#include <iostream>
#include<math.h>
using namespace std;
class Name{
private:
public:
virtual void displayName(){
cout << "inside shape" << endl;
}
};
class First : public Name{
private:
string firstName ;
public:
// CONSTRUCTOR
First(){
}
// overloaded constructor
First(string name){
firstName = name;
}
// DESTRUCTOR
~First(){
}
// setter function
void setFirstName(string name){
firstName = name;
}
string getFirstName(){
return firstName;
}
void displayName(){
cout << getFirstName() << " ";
}
};
class Last : public Name{
private:
string lastName ;
public:
// constructor
Last(){
}
// overloaded constructor
Last(string name){
lastName = name;
}
// desctructor
~Last(){
}
// accessor, and mutating
void setLastName(string name){
lastName = name;
}
string getLastName(){
return lastName;
}
void displayName(){
cout << getLastName() << " ";
}
};
int main()
{
First F1;
F1.setFirstName("deepak");
Last L1;
L1.setLastName("rajdev");
cout << " FullName : " << endl;
F1.displayName();
L1.displayName();
First F2("deepak1");
Last L2("rajdev1");
cout << endl << " Full Name : " << endl;
F2.displayName();
L2.displayName();
cout << endl;
return 0;
}
Description : Following points have been covered
1. Define a class Name with appropriate data member(s) and member functions (at least constructors and a destructor for each class.)
2. Define the class First derived from the class Name that will create your first name with appropriate data member(s) and member functions (at least constructors and destructor for each class.)
3. Define the class Last derived from the class Name that will create your last name with appropriate data member(s) and member functions (at least constructors and destructor for each class.)
4. You will create an object of the class First and an object of the class Last using the default constructors and constructors with arguments.
5. The default constructors initialize the two objects F1 and L1. An overloaded constructors will obtain the first name and the last name from the keyboard and create objects F2 and L2.
6. The program will then display your full name using the function displayName() to display your full name in the format shown below.
Firstname Lastname
7. Once the first name and last name are displayed, the program ends.
8. Other member functions for the 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.
Let me know if you face any problem to run the above program.
Thanks,
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.