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

This question has been posted many times but non of the codes work in Visual stu

ID: 3871470 • Letter: T

Question

This question has been posted many times but non of the codes work in Visual studio.

Visual Studio (c++)

I included an exmaple at the end. Thank you in advance. My friends also need the code so you will get many thumbs up for a clean code with no errors.

You must divide your files into .cpp and .h file.

Note that you are NOT allowed to make the attributes public for this lab. All attributes must be privateand your methods should be public.

Write a program that makes a collection of students. Your data file contains a set of information about students. Your program should contain four classes: StudentCollection, StudentProfile, Person, Student, and Course.

StudentCollection has the following attributes:

            vector<StudentProfile>          StCollection;

StudentProfile class has the following attributes:

Person             PersonalInfo
Student            StdInfo

Person class has the following attributes:

long                 SSN
string               Fname
string               Lname
int                    Age
char                 Gender (‘M’ for Male and ‘F’ for Female)

Student class has the following attributes:

long                 StNo
Course             Course1
Course             Course2
Course             Course3

Course             Course4

Course             Course5

Course class has the following attributes:

long                 CourseNum
string               CourseName

Place the following in your transaction file:

123456789

Mary

Anderson

20

F

9800300699

32451

CS211

23145

CS231

87690

Phy301

25677

Chem210

22213

Math210

633322789

Mike

Smith

22

M

9080022299

32251

CS111

11122

Math110

87969

Phy200

25627

Chem110

33313

Bio211

631322111

Michelle

Brown

25

F

611354321

11111

CS911

22222

Math912

33333

Phy913

44444

Chem914

55555

Bio915

Similar exmaple :

Main.Prog.cpp

#ifndef Main_C

#define Main_C

#include<iostream>

#include<iomanip>

#include<fstream>

#include<string>

#include<vector>

using namespace std;

#include "Album.h"

#include "AlbumCollection.h"

/*

// using C++ functions to get the information into the array

class Album

{

private:

string artist_name;

string title;

string song_name;

double song_length;

public:

void PrintAnAlbum();

void SetAnAlbum(string ArtName, string TheTitle,

string SName, double SLen);

};

//----------------------------------------------------------

class AlbumCollection

{

private:

vector<Album> collection;

public:

void PrintCollections();

void GetInfo();

};

//----------------------------------------------------------

//Implementation

//----------------------------------------------------------

void Album::SetAnAlbum(string ArtName, string TheTitle,

string SName, double SLen)

{

artist_name = ArtName;

title = TheTitle;

song_name = SName;

song_length = SLen;

}

//----------------------------------------------------------

void Album::PrintAnAlbum()

{

cout << " Name of the artist: " << artist_name << endl;

cout << " Title of the Album: " << title << endl;;

cout << " Name of the Song: " << song_name << endl;

cout << " Length of the Song: " << song_length << endl;

}

//----------------------------------------------------------

void AlbumCollection::PrintCollections()

{

for (int i=0; i< collection.size(); i++)

{

cout << "Information about Album number " << i << endl;

cout << "----------------------------------" << endl;

collection[i].PrintAnAlbum();

cout << endl << endl;

}

}

//----------------------------------------------------------

void AlbumCollection::GetInfo()

{

string ArtName;

string TheTitle;

string SName;

double SLen;

ifstream fin;

fin.open("data.txt");

fin >> ArtName >> TheTitle >> SName >> SLen;

while (fin) // or while (!fin.eof())

{

Album newEntry;

newEntry.SetAnAlbum(ArtName, TheTitle, SName, SLen);

collection.push_back(newEntry);

fin >> ArtName >> TheTitle >> SName >> SLen;

}

fin.close();

}

*/

//----------------------------------------------------------

int main()

{

AlbumCollection The_Albums;

The_Albums.GetInfo();

The_Albums.PrintCollections();

return 0;

}

//----------------------------------------------------------

#endif // Main.C

AlbumCollection.h

#ifndef AlbumCollection_H

#define AlbumCollection_H

#include<iostream>

#include<iomanip>

#include<vector>

#include<fstream>

using namespace std;

// using C-functions to get the information into the array

//----------------------------------------------------------

class AlbumCollection

{

private:

vector<Album> collection;

public:

void PrintCollections();

void GetInfo();

};

//----------------------------------------------------------

#endif //AlbumCollection_H

AlbumCollection.cpp

#ifndef AlbumCollection_C

#define AlbumCollection_C

#include<iostream>

#include<iomanip>

#include<fstream>

#include<string>

using namespace std;

#include "Album.h"

#include "AlbumCollection.h"

//----------------------------------------------------------

void AlbumCollection::PrintCollections()

{

for (int i=0; i< collection.size(); i++)

{

cout << "Information about Album number " << i << endl;

cout << "----------------------------------" << endl;

collection[i].PrintAnAlbum();

cout << endl << endl;

}

}

//----------------------------------------------------------

void AlbumCollection::GetInfo()

{

string ArtName;

string TheTitle;

string SName;

double SLen;

ifstream fin;

fin.open("data.txt");

fin >> ArtName >> TheTitle >> SName >> SLen;

while (fin) // or while (!fin.eof())

{

Album newEntry;

newEntry.SetAnAlbum(ArtName, TheTitle, SName, SLen);

collection.push_back(newEntry);

fin >> ArtName >> TheTitle >> SName >> SLen;

}

fin.close();

}

//----------------------------------------------------------

#endif //AlbumCollection_C

Album.cpp

#ifndef Album_C

#define Album_C

#include<iostream>

#include<iomanip>

#include<fstream>

#include<string>

using namespace std;

#include "Album.h"

void Album::SetAnAlbum(string ArtName, string TheTitle, string SName, double SLen)

{

artist_name = ArtName;

title = TheTitle;

song_name = SName;

song_length = SLen;

}

//----------------------------------------------------------

void Album::PrintAnAlbum()

{

cout << " Name of the artist: " << artist_name << endl;

cout << " Title of the Album: " << title << endl;;

cout << " Name of the Song: " << song_name << endl;

cout << " Length of the Song: " << song_length << endl;

}

//----------------------------------------------------------

#endif //Album_C

Album.h

#ifndef Album_H

#define Album_H

#include<iostream>

#include<string>

using namespace std;

// using C-functions to get the information into the array

class Album

{

private:

string artist_name;

string title;

string song_name;

double song_length;

public:

void PrintAnAlbum();

void SetAnAlbum(string ArtName, string TheTitle, string SName, double SLen);

};

#endif // Album_H

Explanation / Answer

#ifndef Main_C

#define Main_C

#include<iostream>

#include<iomanip>

#include<fstream>

#include<string>

#include<vector>

using namespace std;

#include "Album.h"

#include "AlbumCollection.h"

/*

// using C++ functions to get the information into the array

class Album

{

private:

string artist_name;

string title;

string song_name;

double song_length;

public:

void PrintAnAlbum();

void SetAnAlbum(string ArtName, string TheTitle,

string SName, double SLen);

};

//----------------------------------------------------------

class AlbumCollection

{

private:

vector<Album> collection;

public:

void PrintCollections();

void GetInfo();

};

//----------------------------------------------------------

//Implementation

//----------------------------------------------------------

void Album::SetAnAlbum(string ArtName, string TheTitle,

string SName, double SLen)

{

artist_name = ArtName;

title = TheTitle;

song_name = SName;

song_length = SLen;

}

//----------------------------------------------------------

void Album::PrintAnAlbum()

{

cout << " Name of the artist: " << artist_name << endl;

cout << " Title of the Album: " << title << endl;;

cout << " Name of the Song: " << song_name << endl;

cout << " Length of the Song: " << song_length << endl;

}

//----------------------------------------------------------

void AlbumCollection::PrintCollections()

{

for (int i=0; i< collection.size(); i++)

{

cout << "Information about Album number " << i << endl;

cout << "----------------------------------" << endl;

collection[i].PrintAnAlbum();

cout << endl << endl;

}

}

//----------------------------------------------------------

void AlbumCollection::GetInfo()

{

string ArtName;

string TheTitle;

string SName;

double SLen;

ifstream fin;

fin.open("data.txt");

fin >> ArtName >> TheTitle >> SName >> SLen;

while (fin) // or while (!fin.eof())

{

Album newEntry;

newEntry.SetAnAlbum(ArtName, TheTitle, SName, SLen);

collection.push_back(newEntry);

fin >> ArtName >> TheTitle >> SName >> SLen;

}

fin.close();

}

*/

//----------------------------------------------------------

int main()

{

AlbumCollection The_Albums;

The_Albums.GetInfo();

The_Albums.PrintCollections();

return 0;

}

//----------------------------------------------------------

#endif // Main.C

AlbumCollection.h

#ifndef AlbumCollection_H

#define AlbumCollection_H

#include<iostream>

#include<iomanip>

#include<vector>

#include<fstream>

using namespace std;

// using C-functions to get the information into the array

//----------------------------------------------------------

class AlbumCollection

{

private:

vector<Album> collection;

public:

void PrintCollections();

void GetInfo();

};

//----------------------------------------------------------

#endif //AlbumCollection_H

AlbumCollection.cpp

#ifndef AlbumCollection_C

#define AlbumCollection_C

#include<iostream>

#include<iomanip>

#include<fstream>

#include<string>

using namespace std;

#include "Album.h"

#include "AlbumCollection.h"

//----------------------------------------------------------

void AlbumCollection::PrintCollections()

{

for (int i=0; i< collection.size(); i++)

{

cout << "Information about Album number " << i << endl;

cout << "----------------------------------" << endl;

collection[i].PrintAnAlbum();

cout << endl << endl;

}

}

//----------------------------------------------------------

void AlbumCollection::GetInfo()

{

string ArtName;

string TheTitle;

string SName;

double SLen;

ifstream fin;

fin.open("data.txt");

fin >> ArtName >> TheTitle >> SName >> SLen;

while (fin) // or while (!fin.eof())

{

Album newEntry;

newEntry.SetAnAlbum(ArtName, TheTitle, SName, SLen);

collection.push_back(newEntry);

fin >> ArtName >> TheTitle >> SName >> SLen;

}

fin.close();

}

//----------------------------------------------------------

#endif //AlbumCollection_C

Album.cpp

#ifndef Album_C

#define Album_C

#include<iostream>

#include<iomanip>

#include<fstream>

#include<string>

using namespace std;

#include "Album.h"

void Album::SetAnAlbum(string ArtName, string TheTitle, string SName, double SLen)

{

artist_name = ArtName;

title = TheTitle;

song_name = SName;

song_length = SLen;

}

//----------------------------------------------------------

void Album::PrintAnAlbum()

{

cout << " Name of the artist: " << artist_name << endl;

cout << " Title of the Album: " << title << endl;;

cout << " Name of the Song: " << song_name << endl;

cout << " Length of the Song: " << song_length << endl;

}

//----------------------------------------------------------

#endif //Album_C

Album.h

#ifndef Album_H

#define Album_H

#include<iostream>

#include<string>

using namespace std;

// using C-functions to get the information into the array

class Album

{

private:

string artist_name;

string title;

string song_name;

double song_length;

public:

void PrintAnAlbum();

void SetAnAlbum(string ArtName, string TheTitle, string SName, double SLen);

};

#endif // Album_H

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote