I have an assignment a C++ assignment and here is my code so far;
#include <iostream.h>
#include <stdlib.h>
#include <cstring>
#include <cctype>
class Student
{
private:
char Name[80];
long SSN ;
public:
Student (char, long);
void setSSN (int SSN);
void setName (int Name);
int getSSN (long);
int getName (char);
};
Student::Student (char Name, long SSN)
{
char Name [80] = "unassigned";
long SSN = 999999999;
}
int Student::getName()
{
return Name;
}
int Student::getSSN()
{
return SSN;
}
void Student::setName(int name)
{
int name = "John Doe"
}
void Student::setSSN(int ssn)
{
int ssn = 123456789
}
void printName(Student *nameprint);
void updateName(Student *nameprint);
void printSSN(Student *ssnprint);
void updateSSN(Student *ssnprint);
int main()
{
Student myStudent;
Student mySSN;
printName(&myStudent);
updateName(&myStudent);
printName(&myStudent);
printSSN(&mySSN);
updateSSN(&mySSN);
printSSN(&mySSN);
return 0;
}
void printName(Student *dName)
{
cout << dName->getName( ) << endl;
}
void printSSN(Student *dSsn)
{
cout << dSsn->getSSN( ) << endl;
}
void updateName(Student *nameprint)
{
namePrint->setName(int name);
}
void updateSSN(Student *ssnprint)
{
namePrint->setSSN(int ssn);
}
I need it to do this:
Create a class named Student. The class should consist of the following private member variables: social security number and name (last, first or first, last?). The social security number (SSN) should be a long integer. The name variable should be a character array of 80 characters. (This means use a C-style string only. You may not use a string/String class anywhere.)
Create the following class member functions: setSSN, getSSN, setName, getName. Each of the functions should be public.
The setSSN function should accept 1 argument and update the the social security number member variable. Do not allow the the social security number to be set to zero or less than zero. The getSSN should return the class SSN.
The setName member function should accept one string argument. Use the argument to update the name class member variable. Do not update the class variable for name if the argument has a length of 0. (This indicates the name in the argument is "empty".) The getName method should return the class value for name.
Create a default constructor. (This constructor will accept no arguments.) Use the default constructor to initialize the social security number to 999999999 and the name to "unassigned".
Make sure all your methods are defined in the implementation section of the class. Do not use any inline member functions.
Do not print from the Student class. Instead retrieve the data in the main() function and print from main.
Create a main function. In the main method create two Student objects. Use the appropriate get functions to print all the values of all the member variables for the first Student object. For the second object, use the set methods to change the student name to John Doe and the social security number to 123456789. Use the appropriate get functions to print all the values of all the member variables for the second Student object.
I am having MANY issues, what am I doing wrong??