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

Problem description: In this programming assignment you are to create three clas

ID: 3663409 • Letter: P

Question

Problem description: In this programming assignment you are to create three classes to store student information using C++. You will then read a single record from the keyboard and output it to the screen.

Program requirements: The requirements for this program are as follows:

(1) Create a Student class containing five fields:

Student

-eid: int

-first: string

-last: string

-campusAddress: Address

-transcript: Transcript

(2) Create an Address struct containing four fields:

Address

+street: string

+city: string

+state: string

+zipcode: string

(3) Create a Transcipt class containing two fields:

Transcript

-numberOfCoursesTaken: int

-cummulativeGPA: double

(4) For each class provide the following methods:

• constructor with optional parameters

• accessors

• toString method

(5) Each class should be separated into its interface file (.h) and implementation file (.cpp)

(6) Create the readStudentRecord() function that returns a Student record, read in from the keyboard.

(7) Create the displayStudentRecord() function that displays to the screen a single student record.

(8) Create the writeStudentRecordToFile() function that writes the record to a file. The filename should be provided as an argument to the function.

(9) In the driver (main.cpp), instantiate a single Student record and ask the user for initial values. Once the object is initialized, call the display function above to output the record to the screen and the write function to save to the file. All fields should be output.

Explanation / Answer

//Address as struct type

struct Address{

    string street;

    string city;

    string state;

    string zipcode;

};

// Student class defined here

class Student{

     private int studentid;

     private string firstname;

     private string lastname;

     private string campusAddress;

     private string transcript;

public :

    // student default constructor

    Student(){

    }

    //parameterized constrcutor of student class    

    Student(int studentid,string firstname,string lastname,string campusAddress,string transcript){       

        studentid= studentid;

        firstname = firstname;

        lastname = lastname;

        campusAddress = campusAddress;

        transcript = transcript;

    }

    //toString method

    public string toString(){

        cout<< "from student class -- toString method";

    }

    //readStudentrecord

    public int readStudentrecord(int studentrecord){

        return studentrecord;

    }

    //display the studentrecord as single record

    public void displayStudentRecord(){

        cout<<"student record details"<<endl;

        cout<<"studentid"<<studentid;

        cout<<"firstname"<<firstname;

        cout<<"lastname"<<lastname;

        cout<<"campusAddress"<<campusAddress;

        cout<<"transcript"<<transcript;

    }

    //write student record into file

    public void writeStudentRecordToFile(ofstream storedata, int studentid,string firstname,string lastname,

            string campusAddress,string transcript){

        outfile.open("Studentrecord",ios::out);

        cin>>studentid;

        //outfile<<studentid<<endl;

        cin>>firstname;

        cin>>lastname;

        cin>>campusAddress;

        cin>>transcript;

        //file closes here

        outfile.close();

    }

};

// Transcription class here

class Transcript{

   private int numberofCoursesTaken;

   private double cummulativeGPA;

public:

    //default constructor

    Transcript(){

        //object intialization here

    }

    //parameter constructor

    Transcript(int numberofCoursesTaken,double cummulativeGPA ){

        numberofCoursesTaken = numberofCoursesTaken;

        cummulativeGPA = cummulativeGPA;

    }

    //toString method

    public string toString(){

          cout<< "from toString method";

    }

};

//Student class header file

//header file

// File:   StudentClass.h

// Author: HARE KRISHNA

// Created on 26 January, 2016, 12:38 PM

#ifndef _STUDENTCLASS_H

#define            _STUDENTCLASS_H

#endif /* _STUDENTCLASS_H */

//Transcription header file here

// File:   Transcript.h

// Author: HARE KRISHNA

// Created on 26 January, 2016, 12:39 PM

#ifndef _TRANSCRIPT_H

#define            _TRANSCRIPT_H

#endif /* _TRANSCRIPT_H */

//using main class student details here

int main(int argc, char** argv) {

     // creating objects of student class

    Student studentrecord1;

    //parameresised constructor here

    studentrecord1.Student(100,"john","sanapall","srikakulam","hai");

    //accessing methods here

    studentrecord1.writeStudentRecordToFile("studentdata",101,"sachin","samuel","india","hello");

    //get the recordnumber

    studentrecord1.readStudentrecord(101);

    //display student records here

    studentrecord1.displayStudentRecord();

    return 0;

}

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