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

I\'m willing to give you 6000 points if you completely finish it. After I checke

ID: 645533 • Letter: I

Question

I'm willing to give you 6000 points if you completely finish it. After I checked your work, I will send you link for another 4500 points since I can only give you maximum of 1500 points per question.

This is the instruction of my project. This is related with project 1 which I already finished so please see below my project 1 and you should finish this project by using project 1 as a starting point.

-------------------------------------------------------------------------------------------------------------------------------------------------------

#ifndef ASSIGNMENT_H

#define ASSIGNMENT_H

#include

#include

using namespace std;

//class for assignments

class Assignment{

private:

static int aIdCounter;

int m_nAssignmentId;

string m_strAssignmentName;

string m_strAssignmentType;

int m_nPointsPoss;

int m_nPointsRecd;

double m_dPercentageGrade;

friend class Backdoor;

public:

//default constructor

Assignment()

{

m_nAssignmentId = -1;

m_strAssignmentName = "VOID";

m_strAssignmentType = "VOID";

m_nPointsPoss = -1;

m_nPointsRecd = -1;

m_dPercentageGrade = -1.00;

}

//constructor with parameters

Assignment(string init_name, string init_type, int init_poss, int init_recd)

{

aIdCounter++;

m_nAssignmentId = aIdCounter;

m_strAssignmentName = init_name;

m_strAssignmentType = init_type;

m_nPointsPoss = init_poss;

m_nPointsRecd = init_recd;

m_dPercentageGrade = (double)m_nPointsRecd / (double)m_nPointsPoss;

}

//gets the class member information

int get_id(){return m_nAssignmentId;}

string get_name(){return m_strAssignmentName;}

string get_type(){return m_strAssignmentType;}

int get_poss(){return m_nPointsPoss;}

int get_recd(){return m_nPointsRecd;}

double get_grade(){return m_dPercentageGrade;}

//sets the class member information

void set_name(string init_name){m_strAssignmentName = init_name;}

void set_type(string init_type){m_strAssignmentType = init_type;}

void set_poss(int init_poss){m_nPointsPoss = init_poss;}

void set_recd(int init_recd){m_nPointsRecd = init_recd;}

};

#endif

-----------------------------------------------------------------------------------------------------------------------------------------------------

#ifndef STUDENT_H

#define STUDENT_H

#include

#include

using namespace std;

//class for students

class Student{

private:

static int sIdCounter;

int m_nStudentId;

string m_strLastName;

string m_strFirstName;

public:

//default constructor

Student()

{

m_nStudentId = -1;

m_strLastName = "VOID";

m_strFirstName = "VOID";

}

//constructor with parameters

Student(string init_lastname, string init_firstname)

{

sIdCounter++;

m_nStudentId = sIdCounter;

m_strLastName = init_lastname;

m_strFirstName = init_firstname;

}

//gets the class member information

int get_id(){return m_nStudentId;}

string get_lastname(){return m_strLastName;}

string get_firstname(){return m_strFirstName;}

//sets the class member information

void set_lastname(string init_lastname){m_strLastName = init_lastname;}

void set_firstname(string init_firstname){m_strFirstName = init_firstname;}

};

#endif

-----------------------------------------------------------------------------------------------------------------------------------------------------

#include "Student.h"

#include "Assignment.h"

#include

#include

#include

using namespace std;

int Student::sIdCounter = 9000;

int Assignment::aIdCounter = 20150000;

bool backdoor=false;

//creates and intitializes the array

const int size = 10;

Student roster[10] =

{

Student("Burrows", "Wade"),

Student("Rodriguez", "Steven"),

Student("Liverman", "Paul"),

Student("Gillespie", "Patrick"),

Student("Swarzenegger", "Arnold"),

Student("Obama", "Barack"),

Student("Bush", "George"),

Student("Fallon", "Jimmy"),

Student("Proudmore", "Jaina"),

Student("Fey", "Tina")

};

Assignment list[10] =

{

Assignment("Test 1", "Test", 100, 0),

Assignment("Test 1", "Test", 100, 79),

Assignment("Test 1", "Test", 100, 80),

Assignment("Test 2", "Test", 50, 40),

Assignment("Test 2", "Test", 50, 41),

Assignment("Test 2", "Test", 50, 42),

Assignment("Quiz 1", "Quiz", 30, 27),

Assignment("Quiz 1", "Quiz", 30, 28),

Assignment("Quiz 2", "Quiz", 30, 30),

Assignment("Quiz 2", "Quiz", 30, 32)

};

void queryLN();

void queryPR();

void choice();

void backdoorOpen()

{

cout << " This is where the Backdoor Code would go if we had implemented it yet." << endl;

cout << " Pretend you now have full access to all records and can do anything you want" << endl << "with any of the records in the system." << endl;

cout << " We will now return you to the normal program."<< endl << endl;

cout << "5" << endl;

Sleep(1200);

cout << "4" << endl;

Sleep(1200);

cout << "3" << endl;

Sleep(1200);

cout << "2" << endl;

Sleep(1200);

cout << "1" << endl << endl;

Sleep(1200);

choice();

}

//exits program unceremoniously

int exit()

{

return 0;

}

//this gives user the choice of searching again

void again()

{

char yn;

cout << " Would you like to search again? (Y/N) ";

cin >> yn;

switch (yn)

{

case 'Y': //fallthrough intentional

case 'y':

cout << endl;

choice();

break;

case 'N': //fallthrough intentional

case 'n':

cout << " Goodbye.";

Sleep(1000);

exit();

break;

default:

again();

break;

}

}

//initial choice to begin the program

void choice()

{

char selection;

cout << "What type of search would you like to perform ?"<< endl << endl;

cout << "1. Search by Points Received" << endl;

cout << "2. Search by Last Name" << endl << endl << endl << endl;

cout << "Enter your choice: ";

cin >> selection;

switch (selection)

{

case '1':

backdoor = false;

queryPR();

break;

case '2':

backdoor = false;

queryLN();

break;

case '!':

if (backdoor==true)

{

backdoorOpen();

break;

}

else

{

backdoor = true;

cout << " Please make a valid selection." << endl<< endl;

choice();

break;

}

default:

backdoor = false;

cout << " Please make a valid selection." << endl<< endl;

choice();

break;

}

}

//searches array by Last Name

int searchLN(Student object[], int size, string value)

{

int index = 0; //used as a subscript to search array

int position = -1; //used to record position of search value

bool found = false; //flag to indicate if the value was found

while (index < size && !found)

{

if (object[index].get_lastname() == value) //if the value is found

{

found = true; //sets found flag to true

position = index; //record the value's subscript

}

index++; //go to next element

}

return position; //returns the position of the element, or -1

} //end search

//searches array by Points Received

int searchPR(Assignment object[], int size, int value)

{

int index = 0; //used as a subscript to search array

int position = -1; //used to record position of search value

bool found = false; //flag to indicate if the value was found

while (index < size && !found)

{

if (object[index].get_recd() == value) //if the value is found

{

found = true; //sets found flag to true

position = index; //record the value's subscript

}

index++; //go to next element

}

return position; //returns the position of the element, or -1

} //end search

void queryLN()

{

string desiredLN; //the Last Name to look for

int pos; //position of desired object in array

//get Last Name to search for

cout << " Enter a Last Name (case sensitive): ";

cin >> desiredLN;

//search for the object

pos = searchLN(roster, size, desiredLN);

//if pos = -1, the code was not found

if (pos == -1)

cout << " That Last Name does not exist." << endl;

else

{

//The object was found

cout << "StudentID: " << roster[pos].get_id()<< endl;

cout << "First Name: " << roster[pos].get_firstname() << endl;

cout << "Last Name: " << roster[pos].get_lastname()<< endl;

}

again();

}

void queryPR()

{

int desiredPR; //the Point Received to look for

int pos; //position of desired object in array

//get Last Name to search for

cout << " Enter Point Received: ";

cin >> desiredPR;

//search for the object

pos = searchPR(list, size, desiredPR);

//if pos = -1, the code was not found

if (pos == -1)

cout << " That amount of points does not exist." << endl;

else

{

//The object was found

cout << "AssignmentID: " << list[pos].get_id()<< endl;

cout << "Assignment Name: " << list[pos].get_name()<< endl;

cout << "Assignment Type: " << list[pos].get_type()<< endl;

cout << "Points Possible: " << list[pos].get_poss()<< endl;

cout << "Points Received: " << list[pos].get_recd()<< endl;

cout << "Grade: " << list[pos].get_grade()*100<<"%" << endl;

}

again();

}

//This keeps the program open at the end so we can see the results.

void endProgram(){

//commented out code should be commented back if cin is used in any of the functions

/**/ cin.clear();

cin.ignore(255, ' ');/**/

cin.get();

}

int main(){

choice();

endProgram();

}

-----------------------------------------------------------------------------------------------------------------------------------------------------

These are Assignment.h, Student.h, and Source.cpp files that I finished in project 1.

You must make it so that you can save the data to a file and retrieve it from the file for use later. You will want methods for saving and retrieving data. You will also need to make sure that if someone tries to create a duplicate student and/or class that you prevent him or her from doing this. You may allow editing but you must not allow two records for the same student. As it could be really nasty if someone didn't save changes before exiting the application, you should also give them a friendly warning if they try to do something silly like this.

Explanation / Answer

void writeToFile(Student object[],Assignment assgn[])

{

ofstream wrif;

wrif.open("StudentAssign.txt");

int count;

string name,lname,inname,intass;

int n,n1;

for(int i=0;i<=10;i++)

{

for(int j=i=1;j<=10;j++)

{

string name=object[i].get_firstname();

string cname=object[j].get_firstname();

if(name==cname)

count++;

}

}


if(count==0)

{

for(int i=0;i<=10;i++)

{

name=object[i].get_firstname();

lname=object[i].get_lastname();

inname=assgn[i].get_name();

intass=assgn[i].get_type();

n=assgn[i].get_poss();

n1=assgn[i].get_recd();

wrif<<name<<lname<<inname<<intass<<n<<n1;

}

}

//searches array by Last Name


void readFromFile(Student object[],Assignment assgn[])

{

   ifstream infile;

infile.open("StudentAssign.txt");

string data;

while(!infile.eof())

{

   infile>data;

cout<<data;

}

}