Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(C++ language, IDE Visual Studio 2013(if you do not have VS2013 i image that wil

ID: 670249 • Letter: #

Question

(C++ language, IDE Visual Studio 2013(if you do not have VS2013 i image that will be ok as long as the IDE converts))

*/scenario,

You have been contracted by a small college named CSU that would like for you to implement a custom software system for managing students data. As a prototype you decided to show them a menu driven example. Your menu driven example has the following features:

A) Show student information

B) Edit student information
C) Add courses to student schedule
D) Remove courses from student schedule
E) Display the entire university (alphabetical by last name)
F) Search for student by first name or last name
G) Access to the database requires a user account and password authenticationc /*

*The user of your system is the registrar/administrators. It is NOT intended to be used by students to access their records. Therefore, you only need a few login ids such as registrar, deans, etc.

*All features are available on the menu, the structure can be set up however.

* Files: All student data must be stored in the file system. You may use any file organization. Files can only be read at the start of the program and before the program exits. Here are a few ideas for organizing the files. You may use one of these or an alternate structure of your own. Note that you may have other data files such as the userid and password file that are not shown here:

(these examples below the program doesnt have to be like them but i would prefer you use and show me one of them which ever one is your choice.)

*/ EXAMPLE /*

single file - one record per student

File format
fname   lname stuid numCourses cname1 cname2 .... cnameN

An example with 2 student records would be:

Mary   Smith   900678   3 CIST2255 CIST1234 MATH2345
John   Jacobs 900134   2 CIST3456 ENGL1105

*/ EXAMPLE /*

multifile - student file and course file

Student File format
fname lname stuid

Course File format
stuid cname

An example with 2 student records would be:

Student File
Mary   Smith   900678
John   Jacobs 900134

Course File
900678 CIST2255
900678 MATH2345
900134 ENGL1105
900134 CIST3456
900678 CIST1234

* Classes: The software is designed using at least three classes: Student, Undergraduate (inherits from Student), and Graduate (inherits from Student).
You are encouraged to include other classes as you deem necessary to make exploit the most reasonable Object-oriented design. For every .cpp file there needs to be a .h file except the driver with the int main.

* C++ Features: The program should incorporate as much as needed from the following: dynamic arrays, classes, constructors, destructors, setters/getters, inheritance, polymorphism, operator overloading, exceptions, templates, etc. Do not use the STL for this assignment. For every .cpp file there needs to be a .h file except the driver with the int main.

The Student class provides the basic framework for creating subclasses. It will contain the following attributes:
        First and Last Name of the student
        Student ID (9 digits, starting with the number 900)
    - Major
        Current class schedule
        Current enrolled course hours

The Undergraduate class has at least the following responsibilities:
        The student's classification: Freshman, Sophomore, Junior, Senior

The Graduate class has at least the following responsibilities:
        The Degree type: Specialist, Master, Doctorate
        Thesis Topic

*/ Could you add comments to what is going on in each function or important line? I learn best from seeing a complete code that works in the IDE i stated at the top, and dissecing the code to figure out whats going on. Thanks a lot! /*

Explanation / Answer

#include "password.h"
#include "fileVector.h"
#include <string>
#include <iostream>
#include <vector>
using namespace std;
int PrnMainMenu();
void getChoice();
void addEntry();
void addEntry(vector<fileVector> &StudentInfo, fstream& afile);
void enter();
int main()
{  
vector<fileVector>StudentInfo ;
fstream fileData("StudentInfo.txt");
string password;
string userName;
cout<<"Enter Name:"<<endl;
cin>>userName;
cout<<"Enter your Password"<<endl;
cin>>password;
getcompareusernamePassword(userName, password);
getChoice();
system("pause");
}
void getChoice()
{
int choice = PrnMainMenu();
while (choice <=5)
{
switch (choice)
{
/*case 1:
enter();
break;
case 2:
SearchLastName();
break;
case 3:
DisplayAlphebetically();
break;
case 4:
editFiles();
break; */
default:
cout << "Please enter a valid number or enter 5 to exit." << endl;
break;
}

PrnMainMenu();
}
}
int PrnMainMenu()
{
int choice;
cout<<"                      MAIN MENU";
cout<<"                    Select one:";
cout<<"                     1. Search students by First Name";
cout<<"                     2. Search students by Last Name";
cout<<"                     3. Display all Students Alphebetically";
cout<<"                     4. Edit files";
cout<<"                     5. Quit";
cout<<"                 Enter choice (1-6)===>";
cin>>choice;
while(choice<1 || choice>5)
{
cout<<" ERROR...re-enter choice(1-5)===>";
cin>>choice;
}
return choice;
}
void enter()
{
// Create a vector to hold studentinfo objects.
vector<fileVector>StudentInfo ;
fstream fileData("StudentInfo.txt");
// Get five entries from the user.
cout << "Creating   entries in the student information... ";
// for (int i = 0; i < 2; i++)
while (!fileData.eof())
{
addEntry(StudentInfo, fileData);
cout << "Entry added. ";
cout << "------------------------ ";
}
StudentInfo.pop_back();
// Step through the vector, printing each
// object's data.
cout << " Here are the entries: ";
cout << "----------------------- ";
for (int i = 0; i <StudentInfo.size(); i++)
{
StudentInfo[i].print();
cout << "----------------------- ";
}
// ... (populate the vector)
vector<fileVector>::iterator n;
cout<<"This the student iformation stored in vector "<<endl;
for (vector<fileVector>::iterator n =StudentInfo.begin();
n != StudentInfo.end();++n)
addEntry(StudentInfo, fileData);
fileData.close();
// return 0;
}
void addEntry(vector<fileVector> &StudentInfo, fstream& afile)
{
string firstname;
string lastname;  
string idnumber;   
string class1;    
string class2;     
string class3;     
string hours;        
string classification;
string degreetype;
string thesis;
// Get the person's first name.
cout << "Enter a person's first name: ";
getline(afile, firstname);
// Get the person's last name.
cout << "Enter the person's last name: ";
getline(afile, lastname);
// Get the person's id.
cout << "Enter the person's id number: ";
getline(afile, idnumber);
cout << "Enter the person's class1: ";
getline(afile, class1);
cout << "Enter the person's class2: ";
getline(afile, class2);
cout << "Enter the person's class3: ";
getline(afile, class3);
cout << "Enter the person's class hours: ";
getline(afile, hours);
cout << "Enter the person's classification ";
getline(afile, classification);
cout << "Enter the person's degree type: ";
getline(afile, degreetype);
cout << "Enter the person's thesis: ";
getline(afile, thesis);
// Create a studentvector object initialized with
// this data.
fileVector entry(string firstname,string lastname,string idnumber,string class1,string class2,string class3,string hours,string classification,string degreetype, string thesis );
// Store the entry in the vector.
StudentInfo.push_back(entry); //!!!!This is Where the problem is!!!!
}
the following header file Student.h hold the information for each student
#ifndef STUDENT_H
#define STUDENT_H
#include <string>
#include <iostream>
using namespace std;
class Student
{
protected:
string FirstName;
string LastName;
string IDNumber;
string Major;
string ClassSchedule;
int EnrolledHours;
public:
//constructors
Student();
Student(string fname,string lname,string id,string schedule,int eh);
//mutators calls
void setFirstName(string fname);
void setLastName(string lname);
void setIDNumber(string id);
void setClassSchedule(string schedule);
void setEnrolledHours(int eh);
//accessors
string getFirstName();
string getLastName();
string getIDNumber();
string getClassSchedule();
int getEnrolledHours();
virtual void print();
};
#endif
this is student.cpp
#include "Student.h"
#include <string>
#include <iostream>
using namespace std;
Student::Student()
{
FirstName="";
LastName="";
IDNumber="";
ClassSchedule="";
EnrolledHours=0;
}
Student::Student(string fname,string lname,string id,string schedule,int eh)
{
FirstName=fname;
LastName=lname;
IDNumber=id;
ClassSchedule=schedule;
EnrolledHours=eh;
}
void Student::setFirstName(string fname)
{
FirstName=fname;
}
void Student::setLastName(string lname)
{
LastName=lname;
}
void Student::setIDNumber(string id)
{
IDNumber=id;
}
void Student::setClassSchedule(string schedule)
{
ClassSchedule=schedule;
}
void Student::setEnrolledHours(int eh)
{
EnrolledHours=eh;
}
string Student::getFirstName()
{
return FirstName;
}
string Student::getLastName()
{
return LastName;
}
string Student::getIDNumber()
{
return IDNumber;
}
string Student::getClassSchedule()
{
return ClassSchedule;
}
int Student::getEnrolledHours()
{
return EnrolledHours;
}
void Student::print()
{
cout<<FirstName<<LastName<< IDNumber<<Major <<ClassSchedule<< EnrolledHours<<endl;
}
the following class gets what degree they have and what their thesis topic was about
graduate.h
#ifndef GRADUATE_H
#define GRADUATE_H
#include <string>
#include <iostream>
#include "Student.h"
using namespace std;
class Graduate:public Student
{
protected:
string DegreeType;
string ThesisTopic;
public:
//constructor
Graduate();
//constructor overload
Graduate(string fname,string lname,string id,string schedule,int eh,string dt,string top);
//mutator functon calls
void setDegreeType(string dt);
void setThesisTopic(string top);
//accessor call
string getDegreeType();
string getThesisTopic();
virtual void print();
};
#endif
graduate.cpp
#include "Graduate.h"
#include "Student.h"
#include <string>
#include<iostream>
using namespace std;
Graduate::Graduate()
{
DegreeType="";
ThesisTopic="";
}
//constructor overload
Graduate::Graduate(string fname,string lname,string id,string schedule,int eh,string dt,string top):Student( fname, lname, id, schedule, eh)
{
setDegreeType(dt);
setThesisTopic(top);
}
void Graduate::setDegreeType(string dt)
{
DegreeType=dt;
}
void Graduate::setThesisTopic(string top)
{
ThesisTopic=top;
}
//accessor call
string Graduate::getDegreeType()
{
return DegreeType;
}
string Graduate::getThesisTopic()
{
return ThesisTopic;
}
void Graduate::print()
{
cout<<FirstName<<LastName<< IDNumber<<Major <<ClassSchedule<< EnrolledHours<<DegreeType<<ThesisTopic<<endl;
}
the following class determines if the undergraduate is junior, sophomore, etc.
undergraduate.h
#ifndef UNDERGRADUATE_H
#define UNDERGRADUATE_H
#include <string>
#include <iostream>
#include "Student.h"
using namespace std;
class Undergraduate:public Student
{
protected:
string Classification;
public:
//constructor
Undergraduate();
//constructor overload
Undergraduate(string fname,string lname,string id,string schedule,int eh,string cl);
//mutator functon calls
void setClassification(string cl);
//accessor call
string getClassification();
virtual void print();
};
#endif
undergraduate.cpp
#include "Undergraduate.h"
#include "Student.h"
#include <string>
#include<iostream>
using namespace std;
Undergraduate::Undergraduate()
{
Classification="";
}
//constructor overload
Undergraduate::Undergraduate(string fname,string lname,string id,string schedule,int eh,string cl):Student( fname, lname, id, schedule, eh)
{
setClassification(cl);
}
void Undergraduate::setClassification(string cl)
{
Classification=cl;
}
//accessor call
string Undergraduate::getClassification()
{
return Classification;
}
void Undergraduate::print()
{
cout<<FirstName<<LastName<< IDNumber<<Major <<ClassSchedule<< EnrolledHours<<Classification<<endl;
}
the followiing and last class will be used to hold the objects of student, undergraduate, and graduate.
filevector.h
#ifndef FILEVECTOR_H
#define FILEVECTOR_H
#include "Student.h"
#include <iostream>
#include <string>
#include <vector>
#include <fstream>
using namespace std;
//prototypes
// vector class
class fileVector :public Student
{
private:
string class1;    //1st class
string class2;    //second class
string class3;     //third class
public:
// Constructor
fileVector();
fileVector(string fn, string ln,string num,string cl1,string sched,string cl2,string cl3,int h,string clf,string dt,string tt) ;
void setclass1(string cl1);
void setclass2(string cl2);
void setclass3(string cl3);
string getclass1();
string getclass2();
string getclass3();
vector<fileVector>StudentInfo ;
// print function
virtual void print();
void enter();
void addEntry(vector<fileVector> &StudentInfo, fstream& afile);
};
#endif
filevector.cpp
#include <iostream>
#include "fileVector.h"
#include <string>
#include <vector>
#include <fstream>
using namespace std;
fileVector::fileVector()
{
class1="";
class2="";
class3="";
}
fileVector::fileVector(string fn, string ln,string num,string sched,string cl1,string cl2,string cl3,int h,string clf,string dt,string tt) :Student( fn , ln , num, sched, h)
{
FirstName=fn;
LastName=ln;
IDNumber=num;
class1=cl1;
class2=cl2;
class3=cl3;
EnrolledHours=h;
// Classification=clf;
// degreetype=dt;
// thesis=tt;
}
void fileVector::setclass1(string cl1)
{
class1=cl1;
}
void fileVector:: setclass2(string cl2)
{
class2=cl2;
}
void fileVector::setclass3(string cl3)
{
class3=cl3;
}
string fileVector:: getclass1()
{
return class1;
}
string fileVector:: getclass2()
{
return class2;
}
string fileVector::getclass3()
{
return class3;
}
void fileVector::print()
{
cout<<FirstName<<LastName<< IDNumber<<Major <<ClassSchedule<< EnrolledHours<<class1<<class2<<class3<<endl;
}