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

I am writing a program that is called class Person, it uses inheritance.The deri

ID: 3639981 • Letter: I

Question

I am writing a program that is called class Person, it uses inheritance.The derived class names are Student and Professor. The user is asked for an ID and the person's name displays. When user asks for input of a students name , their G.P.A and advisees' name is displayed. When asked to enter professor's name their salary and advisees' name. Display all the names of students whose major is not the same as their advisor program, student's name who has the highest G.P.A. Display all the names of students whose G.P.A. is more than 3.0 and whose advisor is Dr. Miller. I have started but I am having problems,getting alot of errors.There are 2 header files: StudentInfo.txt and ProfessorInfo.txt.

#include<iostream>
#include<string>
using namespace std;

#include "StudentInfo.txt" //include definition of class StudentInfo
#include "ProfessorInfo.txt" //include definition of class ProfessorInfo

class Person{ //base class
private:
string Name //member variables
Int ID;
public:
Person( ) //constructor
Person(string & name, int id )
~Person( ) //default constructor
SetName( string & name)
GetName( ) // accessor
SetID(int id) // mutator
GetID( ) //accessor
{ return ID; }
};
class Student : public Person //derived class
{
private:
Float GPA; //member variables
String Major;
Professor * Advisor;
public:
Student(string cname, stringmajor, Person * adv); //constructor
Student(string & name, int id );
~Student( ); //default constructor
SetGPA(float gpa) //mutator
GetGPA( ); //accessor
SetMajor(string& major); //mutator
GetMajor( ); //accessor
SetAdvisor(Professor* advisor); //mutator
GetAdvisor( ); //accessor
}
class Professor : public Person //derived class
{
private:
Int Level; //member variables
Float Salary;
String Program;
public:
Professor( ); //consturctor
Professor(string & name, int id );
~Professor( ); //default constructor
SetLevel(int level ); //mutator
GetLevel( ;) //accessor
SetSalary(float salary);//mutator
{
GetSalary( ); //accessor
{return salary}
SetProgram(string& major); //mutator
GetProgram( ); //accessor
};

int main(){
cout<<" Please enter the ID : "< cin>> ID;

}

*********The text files:
StudentInfo.txt

Name   ID     GPA    Major    Advisor's ID
Mike    934    3.2      CS           199
Jason   783    2.4      Math       311
Jack     893    2.9      ED          102
Monica 688    3.6      CS           199
Emory  915    3.1      CS           199
Tracy   792    1.9      Math        102
Carter  953    2.1      CS           102
Harris   999    2.5      CS           108
James   936    2.4      Math       199
Howard 971    2.8      ED           131
Sean     984    3.3      Math        192
May       932   2.7      CS            192

ProfessorInfo.txt
Name      ID       Level       Salary        Program
Miller     199          3          60000         CS
Bush       311         4          66000          Math
Lewis     102          2          54000          ED
Harris     108         3          60000           CS
James     131         5          72000           CS
Parker     192         2          54000          Math
Young      188         4          66000          Math

Explanation / Answer

for Display all the names of students whose major is not the same as their advisor program:
you can create char, int , or void(print inside) , so for void you will need to :
while(studentName!=null) {
#you will scan firs name from the file before entering a loop.
if (studentMagor(studentD)==advisorMagor(advisorID))
print(sudentName();
#and you will need to scan second name here and assighn it to studentName if end of the file make it null
}


for students who have higher GPA
create an aray of aray[3]
you can use for or while loop
make higher gpa=first student;
if (highergpa<studentGPA(next student id));{
then clean aray;
and assighn first value to second student id
}
if(highrgpa==studentGPA(next student id){
add second value to array remember to keep count for array
}

after you exit from array print values :)
you need to make this way because if all student have the same gpa you will need to print all of them.


Display all the names of students whose G.P.A. is more than 3.0 and whose advisor is Dr. Miller.

use while loop to scan students from file
if (studentGPA(studentNam>3){
y=stringCompare(studentAdvisor(studentName), Miller);
if(y==0)
print("studentName");
}


i hope it gonna help and sintaxes maybe different for different languages , i think you using java so netbeams will help you wo correct ;)

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