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

In c++ language code write the program please. Please double check outputs and c

ID: 3743196 • Letter: I

Question

In c++ language code write the program please. Please double check outputs and conditions. As soon as possible. Thank You

Infile file sample

Wilcot 14 58332.64 definition upward-trending holistic paradigm User-centric global _

Albone 6 67801.22 methodology Virtual _

ThomaNN 5 75204.23 Object-based _

Gordon 3 94106.19 workforce emulation systemic _

snowden 13 81080.28 fault-tolerant Persevering strategy explicit User-centric utilisation _

JiRaS 3 40038.91 De-engineered Automated Ameliorated _

Preddle 6 35835.07 _

Gibberd 10 61142.13 client-driven workforce emulation systemic Adaptive Multi-lateral Distributed _

ALENIN 8 47027.97 ability client-driven matrices Adaptive _

Gossart 9 49833.4 secondary Enhanced Stand-alone Customizable neural-net reciprocal
Front-line Pre-emptive systematic hybrid _

FrEEd 14 31589.96 application definition instruction-set migration Function-based _

wheelband 12 66690.87 software cohesive time-frame superstructure benchmark methodical Reactive info-mediaries intangible _


Fasey 5 93259.77 Future-proofed Triple-buffered _

Thelwll 2 45218.63 web-enabled framework Object-based incremental optimal _

Bridat 1 55384.56 Inverse productivity fault-tolerant Persevering _

Ferrolli 4 42820.19 solution-oriented _

SCHUbart 14 62558.03 Grass-roots intermediate contingency web-enabled _

Trevorrow 6 95306.56 incremental optimal background executive _

1 Wilcot 14 58332.64 definition upward-trending holistic paradigm User-centric global 3 Albone6 67801.22 methodology Virtual_ 5 ThomaNN 5 7204.23 object-based Gordon 3 94106.19 workforce emulation systemic 9 snowden 13 81080.28 fault-tolerant Persevering strategy explicit User-centric utilisation 10 11 JRas 3 40038. 91 Det-erginert red Autotit, ed Aniel iorat.ecd 12 13 Preddle 6 35835.07 15 Gibberd 10 61142.13 client-driven workforce emulation sysLemic Adaptive Multi-lateral Dist.ributed 16 17 ALENIN 47027.97 ability client-driven matrices Adaptive 10 19 Cossart 9 49333.4 sccondary Enhanced Stand-alonc Customizable ncural-net reciprocal 20 Front-lino Prc-omptive systcnatic hybrid 21 22 FrEEd 14 31589.96 application definition instruction-set migration Function-based_ 23 24 wheelband 12 66690.07 software cohesive time-frame superstructure benchmark methodical Reactive info-mediaries intangible 25 26 27 Fasey 5 93259.77 Future-proofed Triple-buftered 28 29 Thelwll 2 45218.63 web-enabled framework Object-based incremental optimal 30 31 Bridat 1 55384.56 Inverse productivity fault-tolerant Persevering 32 33 Ferrolli 4 42820.19 solution-oriented 3 4 35 SCHUbart 14 62558.03 Grass-roots intermediate contingency web-enabled 36 37 Trevorrow 6 95306.56 incremental optimal backaround executive

Explanation / Answer

#include<iostream>
#include<fstream>
#include<string>
#include<string.h>
#include<stdlib.h>
#include <sstream>
#define MAX_PUBLICATION 10
using namespace std;

struct facultyType
{
string name;
string publication[MAX_PUBLICATION];
int amountOfPublication;
int teachingYear;
string salary;//double salary;
};

string format(string);
void fullPrintData(facultyType,int);
void printInstructorData(facultyType *);

void fullPrintData(facultyType data[],int size)
{
for(int i=0;i<size;i++)
{
  cout<<data[i].name<<" "<<data[i].salary;
  cout<<" "<<data[i].teachingYear;
  //cout<<" "<<"No"<<endl;
  //cout<<" List Of Publications"<<endl;
  for(int j=0;j<data[i].amountOfPublication;j++)
  {
   cout<<" "<<data[i].publication[j];
  }
  cout<<endl;
}
}

void printInstructorData(facultyType *data)
{
if(data!=NULL)
{
  cout<<"Name: "<<data->name<<" Salary: "<<data->salary<<endl;
  cout<<"Years Taught: "<<data->teachingYear<<endl;
  cout<<"Tenure: "<<"No"<<endl;
  cout<<" List Of Publications"<<endl;
  for(int i=0;i<data->amountOfPublication;i++)
  {
   cout<<i+1<<": "<<data->publication[i]<<endl;
  }
}
}

int readFacultyDiractory(facultyType arr[])
{
fstream file;
int size=0;
    string word,line, filename,full_filename;
   
  cout<<" Enter Filename:";
  cin>>filename;
  
    full_filename = "C:/Users/temp-01968/Desktop/"+filename;
    file.open(full_filename.c_str());
  if(file.is_open())
  {
   while(getline(file,line))
   {
    arr[size].amountOfPublication=0;
    std::istringstream LINE(line);
    
    LINE >> word;
    arr[size].name=word;
      
   LINE >> word;
   stringstream sal(word);
   sal >> (arr[size].teachingYear);
      
      LINE >> word;
      arr[size].salary=word;
      
      while(LINE >> word)
      {
       if(word.compare("_")==0)
         {
           size++;
           break;
    }
    else
    {
     arr[size].publication[arr[size].amountOfPublication]=word;
     arr[size].amountOfPublication+=1;
    }
    if(arr[size].amountOfPublication==MAX_PUBLICATION)
    {
     break;
    }
   }
    
        
   if(size==20)
   {
    cout<<" Array is full ";
    return size;
   }
  }
  return size;
}
    return -1;
}

int searchFaculty(facultyType arr[],int size,string Name)
{
for(int i=0;i<size;i++)
{
  
  if(format(arr[i].name)==format(Name))
  {
   return i;
  }
}
return -1;
}
string format(string st)
{
st[0]=toupper(st[0]);
for(int i=1;i<st.length();i++)
{
  st[i]=tolower(st[i]);
}
return st;
}

int main()
{

int _year=0;
string _publication;
string _sal;
string Name;

int flag=-1,opt=-1,index=-1,size=-1;
char ch='a';
facultyType obj[20];

while(size==-1)
{
  size=readFacultyDiractory(obj);
}
cout<<" "<<size<<" lines readed from file ";
//fullPrintData(obj,size);
//...............................................................
//...............................................................
while(ch!='n' && ch!='N')
{
  cout<<" Enter Faculty Name:";
  cin>>Name;
  index=-1;
  index=searchFaculty(obj,size,Name);
  if(index!=-1)
  {
   printInstructorData(&obj[index]);
   opt=-1;
   while(opt!=1&&opt!=2&&opt!=3)
   {
   
    cout<<" (1) update Salary ";
    cout<<"(2) update year taught ";
    cout<<"(3) Add a publication ";
    cout<<"Select an option: ";
    cin>>opt;
   }
   switch(opt)
   {
    case 1:
     _sal=-1;
     //while(_sal < (obj[index].salary) && _sal<=0)
     //{
      cout<<" Enter new salary:";
      cin>>_sal;
     //}
     obj[index].salary=_sal;
     break;
    case 2:
     _year=-1;
     while(_year<=0)
     {
      cout<<" Enter new teaching year:";
      cin>>_year;
     }
     obj[index].teachingYear=_year;
     break;
    case 3:
     if(obj[index].amountOfPublication<MAX_PUBLICATION)
     {
      cout<<" Enter new publication:";
      cin>>_publication;
      obj[index].publication[obj[index].amountOfPublication]=_publication;
      obj[index].amountOfPublication+=1;
     }
     break;
    default:
     break;
   }
  }
  else
  {
   cout<<Name<<" not found"<<endl;
  }
  ch='a';
  while(ch!='y'&&ch!='Y'&&ch!='n'&&ch!='N')
  {
   cout<<" Continue? (Y/N)";
   cin>>ch;
  }
}

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