Create a class called Person that stores the name (character array of size 30), gender (single character), and age (type integer). From this class derive two classes: Student, which stores a student id (type integer), faculty name (character array of size 20) and level (type integer), and Employee, which stores a company name (character array of size 20) and salary (type double). Each of these three classes should have setdata( ) method to set its data from the user, getdata( ) method to return the value of each class data member, and a display( ) method to print its data.
Write a main() program to test the person, student and employee classes by creating objects of them, asking the user to fill in data with setdata( ), and then displaying the data with display ( ) method.
السؤال
ليلى سمور
Create a class called Person that stores the name (character array of size 30), gender (single character), and age (type integer). From this class derive two classes: Student, which stores a student id (type integer), faculty name (character array of size 20) and level (type integer), and Employee, which stores a company name (character array of size 20) and salary (type double). Each of these three classes should have setdata( ) method to set its data from the user, getdata( ) method to return the value of each class data member, and a display( ) method to print its data.
Write a main() program to test the person, student and employee classes by creating objects of them, asking the user to fill in data with setdata( ), and then displaying the data with display ( ) method.
2 أجوبة على هذا السؤال
Recommended Posts
انضم إلى النقاش
يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.