need help with try-catch…

I want to add a try catch block in the CalculateAverageRate method where I want the user to enter grades 1,2,3,4,5 and for other numbers to throw an exception... I would also like to make a constructor with three parameters (string name, string surname, string date_birth) in which string attributes are set to the values sent through the parameters and numeric attributes to 0. I made a constructor without parameters (at least I think I did if anyone can to tell me if it's true) but now I want to make this constructor as well

#include <iostream>
#include <stdio.h>
using namespace std;

class Student
{
private:
    string name;
    string surname;
    string date_birth;
    double average_grade;

public:
    Student ()
    {
        name = "";
        last name = "";
        date_birth = "";
        average_grade = 0;
    }
void ChangeBasicData ()
{
    cout << "Enter name:" << endl;
    cin >> name;
    cout << "Enter last name:" << endl;
    cin >> surname;
    cout << "Enter date of birth:" << endl;
    cin >> date_birth;

}

void CalculateAverageRate (/ * int argc, char ** argv * /)
{
float x = 0;
int i;
int a;
int size;

cout << "Enter the number of grades for which you want to calculate the arithmetic mean.";
cin >> size;
for (i = 1; i <= size; i ++) {
    cout << "Enter grade #" << and << ":";
    cin >> a;
    x + = a;
    average_grade = x / (float) size;
}

cout << "The arithmetic mean of your grades is:" << average_grade << endl;
}

void PrintData ()
{
    cout << "Your name is:" << name << '\ n';
    cout << "Your last name is:" << surname << '\ n';
    cout << "Your date of birth is:" << date_birth << '\ n';
    cout << "Your average rating is:" << average_grade << '\ n';
}
};

int main ()
{
       Student obj;
       int i;
       enter:
       cout << "Enter which option you want:" << endl;
       cout << "1. Enter your details" << endl;
       cout << "2. Calculate the average grade" << endl;
       cout << "3. Show all" << endl;
       cout << "4. End of program" << endl;
       cin >> i;
   switch (s) {
      case 1:
        obj.ChangeBasicData ();
        goto enter;
        break;
      case 2:
        obj.CalculateAverageRate ();
        goto enter;
        break;
      case 3:
        obj.PrintData ();
        goto enter;
      case 4:
        cout << "Thanks for the info" << endl;
        break;
      default:
        goto enter;
    }
    return 0;
}

can you help me with this ?

can someone help me write this short programme I am newby...

Create a class Student that will have private attributes string name, string last name, string datebirth, double average grade.

This class must have a constructor without parameters (in which all string attributes are set to an empty string, and numeric attributes to 0) and a constructor with three parameters (string name, string last name, string date_birth) in which string attributes are set to values sent through parameters, and numeric attributes to 0.

It is necessary to make methods:

void ChangeBasicData () within which to enter the value entered name, surname and date of birth by the user and assign these entered values to the attributes

void CalculateAverageRate () within which it is necessary to enter 5 grades (1-5) and calculate their average, and place this value in the appropriate attribute of the class. It is up to you to determine how you will calculate the average grade, whether you want to create a string and enter and then take grades from it for calculation or use a variable as the sum that you will divide later, it doesn't matter. What is important for this method is that you must throw an exception if an invalid value is entered for the evaluation. So the correct values for the rating are (1,2,3,4,5) and every other entry should cause an exception to be thrown. You will "catch" this exception in the main, ie. at the point where you invoke this method. So if you have option 2 in the interactive menu which is Calculate Average Rating, in it you will have a try block where you call this method and then a catch block where you can print the message "You did not enter the correct data. Next time be more careful!" and return to the user the home menu where he selects options.

void PrintsData () within which all data for a student will be printed, e.g.

Student Name: John

Student surname: Isner

Date of birth of student: 07.07.2007

Average student grade: 4.42