1. Declare a class named Student that contains
a. Three private data members:
char firstName[20];
char lastName[20];
int id;
b. Three public member functions:
• SetName function that takes two (char*) parameters and returns nothing.
• SetId function that takes one (int) parameter and returns nothing.
• Display function that takes nothing and returns nothing.
2. Implement the SetName, SetId, and Display member functions declared below:
• SetName function that takes two (char*) parameters and copies them to the firstName and lastName private data members (use strcpy). • SetId function that takes one (int) parameter and assigns it to the id private data member.
• Display function that takes no parameter and prints the firstName, lastName and id of a Student object.
3. Based on the class that you have written in the previous questions, write a main() function that creates a Student object and prints out the following:
Student Name: John Smith
Id: 150306
4. Add to the Student class a default constructor and a destructor. The default constructor should set the name "John Doe" and 0 for the Id. Create a default student object in your main function and print it out with the Display function:
Student Name: John Doe
Id: 0
5. Add a constructor to the Student class that takes three parameters (char*, char*, int) and initializes the firstName, lastName, and id data members. Create a student object in your main function using this constructor with the name "Sally Jones" and with an Id of 12345. Print out the information with the Display function:
Student Name: Sally Jones
Id: 12345
I'm pretty sure I have the whole thing finished, the only problem is I don't know what command to use in the SetId member of the student class. The above underlined and bolded step is the one I got stuck on and skipped. Here is my code:
#include <iostream>
#include <cstring>
using namespace std;