Write a Person class with a constructor that accepts the following details:
1. First name
2. Middle name
3. Last name
4. Date of birth (entered in this pattern 22-02-2000)
5. Gender (male, female)
6. Identity number (private attribute)
7. Mobile number (if any)
Provide a method getAge that calculates the persons' age from his date of birth.
If the user provided his mobile number you have to check if it is a valid number with the pattern 999-
999-9999 if not, show him an error message and do not save the number Provide a method getAge that calculates the persons' age from his date of birth.
If the user provided his mobile number you have to check if it is a valid number with the pattern 999-
999-9999 if not, show him an error message and do not save the numberWrite two classes called Student and College that represents a student and a college in a university. College class: - The constructor of the College class should accept the name of the college and the capacity, and you have to generate a shortcut of the name by taking the first character of each word in the name (e.g., Information Technology becomes IT). - Provide a method called updateTotalStudents that increments the total number of students at this college. You have to check if the total number is in the range of the capacity, if not you have to present a suitable message for the student and let him/her choose another college. You can set the capacity as 3 students for testing purposes. - Provide a method called getInfo that prints the information about specific college in a wellorganized appearance.​

Respuesta :

The person class is an illustration of constructors;

In computer programs, constructors are automatically called when the object of a class is created

The program in C++

The class and the constructor program written in C++ programming language is as follows:

int main(){

   string fname, lname,dob,idno,mobileno;

   cin>>lname; cin>>fname; cin>>dob;  cin>>idno; cin>>mobileno;

Person c(fname,lname,dob,idno,mobileno);

if(mobileno.length() == 12){

    if(mobileno[3] == '-' && mobileno[7] == '-'){

        cout << "Name: " << c.getfname() << " " << c.getlname() << endl

 << "Date of birth: " << c.getdob() << endl

 << "ID number: " << c.getid() << endl

 << "Mobile: " << c.getmobile() << endl

 << "Age: "<< getAge(dob)<<endl;

 ;

    }

}

The complete program is added as an attachment

Read more about C++ programs at:

https://brainly.com/question/13168905

#SPJ1

Ver imagen MrRoyal
ACCESS MORE