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

c++ File Tools CSC 372 Program 1 Fall 2018-1 [Read-Onlyl]- Word Navigation CSC 3

ID: 3742645 • Letter: C

Question

c++

File Tools CSC 372 Program 1 Fall 2018-1 [Read-Onlyl]- Word Navigation CSC 372 Program Assignment 1: Due Date September 20th 11:59 PM Due Date: Tuesday, September 4th 1:29 PM Program Summary Write a C++ object-oriented program to manage a file system for students at Norfolk State University: First Name - string Last Name-string Student ID unsigned integer Email string GPA float The program will manipulate the student list based on students from the file students.dat Class requirements Search document Headings Pages Results Create an interactive outline of your document. It's a great way to keep track of where you are or quickly move your content around. To get started, go to the Home tab and apply Heading styles to the headings in your document 1. Create a student class or struct based on the student structure 2. Create a students class which contains three private members-an array of students, the size of the array, and a function to print the contents of a process. The processes class will also provide the following functionality a. Load data from a data file into a student list b. Retrieve and print a student from the student list c. Insert a student into the student list d. Delete a student from the student list e. Print the contents of a student record f. Print the contents for a list of students g. Sort the student list by last Name h. Sort the student list by GPA Processing requirements 1. Load the students file students.dat 2. Create a menu to carry out the given operations Screen 1 of 2 140% 2:10 PM 8/31/2018

Explanation / Answer

#include<iostream>

#include <fstream>

#include <sstream>

#include <bits/stdc++.h>

using namespace std;

class student

{

private:

string FirstName,LastName,Email;

float GPA;

unsigned int StudentID;

public:

void input(string fname, string lname, string email, float gpa, unsigned int id);

string getFirstName();

string getLastName();

string getEmail();

float getGPA();

int getStudentId();

};

void student::input(string fname, string lname, string email, float gpa, unsigned int id)

{

FirstName = fname;

LastName = lname;

Email = email;

GPA = gpa;

StudentID = id;

}

string student::getFirstName(){

return FirstName;

}

string student::getLastName(){

return LastName;

}

string student::getEmail(){

return Email;

}

float student::getGPA(){

return GPA;

}

int student::getStudentId(){

return StudentID;

}

class students

{

private:

student std[10];

int n;

public:

void print();

void push(student s,int index);

void setCount(int count);

};

void students::push(student s,int index)

{

std[index]=s;

}

void students::setCount(int count)

{

n=count;

}

void students::print()

{

for(int i=0;i<=n;i++){

cout<<"Details of students";

cout<<"First Name : "<< std[i].getFirstName();

}

}

int main()

{

string fname, lname, email;

float gpa;

unsigned int studentId;

int count = 0;

student s1;

students students1;

cout<<"printing";

std::ifstream file("D:\Data\Students.dat");

std::string str;

while (std::getline(file, str))

{

vector <string> tokens;

stringstream check1(str);

string intermediate;

while(getline(check1, intermediate, ' '))

{

tokens.push_back(intermediate);

}

fname = tokens[1];

lname = tokens[2];

stringstream id(tokens[3]);

id >> studentId;

email = tokens[4];

stringstream gp(tokens[5]);

gp >> gpa;

s1.input(fname,lname,email,gpa,studentId);

students1.push(s1,count);

count++;

}

students1.setCount(count);

int process;

cout << "1 Retrieve and print a student from the student list ";

cout << "2 Insert a student into the student list ";

cout << "3 Delete a student from the student list ";

cout << "4 Print the contents of a student record ";

cout << "5 Print the contents for a list of students ";

cout << "6 Sort the student list by last Name ";

cout << "7 Sort the student list by GPA";"

cin >> process;

switch (process)

{

case 1:

students.printStudentList();

break;

case 2:

students.insertStudent(student s);

break;

case 3:

students.deleteStudent(student s);

break;

case 4:

students.printContentStudentRecord();

break;

case 5:

students.printListOfStudents();

break;

case 6:

students.sortByLastNamet();

break;

case 7:

students.sortByGPA();

break;

default:

cout << "Error! option is not correct";

break;

}

}

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