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

C++ This program consist of two parts: 1) reading and processing a student data

ID: 3661821 • Letter: C

Question

C++

This program consist of two parts:
1) reading and processing a student data file, and writing the results to a student report file
2) modifying part 1 to calculate some statistics and writing them to another file.
For this assignment, you will be reading one input file and writing out two other files.

Part 1 Detail

Read in the student data file, partially shown below. This 50 record file consists of a (8-digit numeric) student id, lab exercise points, 8 assignment's points, midterm points, final points, and CodeLab points. You must follow the syllabus specifications for the determination of the letter grades. You will write the input student data and the results of the processing into a student report file that looks "just like" the output shown below. In addition to the input student data, the report should contain the "total" of the assignment grades, the total and percent of all points achieved, and the letter grade. You may assume that the input data file does not contain any errant data.

The Student Data Input File

The Student Report Output File

Part 2 Detail

Write a summary report file that contains the average percent of total points and maximum points for all students. Also, display the number of A's, B's, C's, D's and F's for the students. Your summary output file should look something like this:

Program requirements

You must use at least 2 one-dimension arrays - one for the student's 8 assignment grades and one for all the student total percents. Do not use 2 dimensional arrays - this will be covered in the next assignment.

Your solution must include at least 4 functions. One function must include an array argument and at least one must include a "pass by reference".

All files must be checked for a successful open. They should also be closed when you are finished with them.

Make sure you write the student id with a leading 0, if appropriate (i.e. the 7th id).

The percent of total points must be rounded to the nearest integer. For example, 377 points is 94%, 378 points is 95% and 379 points is 95%.

The letter grade is determined by the "integer" percent. For example, 350 points becomes 88% becomes B+.

Add headings to your output report file. They should be aligned and correctly identify the column data.

Explanation / Answer

Good Wishes,

PROGRAM 1


#include <iostream.h>
#include <fstream.h>

char add_pts(char ex,char tot, char mi,char fi, char cl)

{

return (ex+tot+mi+fi+cl);

}

char total_ass(char ass[])
{
int t=0;
for(int i=0;i<8;i++)
t=t+ass[i];
return char(t);
}
char percent(char pts)
{
int p;
p=pts/5;
return char(pts);
}
char grade(char pts)
{
char gr
if(((pts>90)&&(pts<100))||(pts==100))
{
gr='A';
if((pts==99)||(pts==100))
gr='A+';

else if((pts==90)||(pts==91)))

  gr='A-';
}
elseif((pts<89)&&(pts>80))
{
gr='B';
if((pts==88)||(pts==89))
gr='B+';

else if((pts==80)||(pts==81)))

  gr='B-';

}
elseif((pts<79)&&(pts>70))
{
gr='C';
if((pts==78)||(pts==79))
gr='C+';

else if((pts==70)||(pts==71)))

  gr='C-';

}
elseif((pts<69)&&(pts>60))
{
gr='D';
if((pts==68)||(pts==69))
gr='D+'

else if((pts==60)||(pts==61)))

  gr='D-';

;
}
else
gr='F'
return gr;
}


int main()
{
ifstream infile;
infile.open("std_data", iso::nocreate);
ofstream outfile("std_report");
char std_id[9],ex,ass[8],mi,fi,cl,tot,pts,pct,gr;
while(infile)
{
infile.get(ch);

outfile.put('0');
while(ch!=' ')
{
infile.get(ch);
outfile.put(ch);
std_id.append(ch);
}
outfile.put(' ');
infile.get(ch);
outfile.put(ch);
ex=ch;
outfile.put(' ');
infile.put(ch);
for(int i=0; i<8;i++)
{
infile.get(ch);
ass[i];
outfile.put(ch);
infile.put(ch);
outfile.put(ch);
}
tot=total_ass(ass);
infile.get(ch);
outfile.put(ch);
infile.get(ch);
mi=ch;
outfile.put(ch);
infile.get(ch);
outfile.put(ch);
infile.get(ch);
fi=ch;
outfile.put(ch);
infile.get(ch);
outfile.put(ch);
infile.get(ch);
cl=ch;
outfile.put(ch);
outfile.put(' ');
pts=add_pts(ex,tot,mi,fi,cl);
outfile.put(pts);
pct=percent(pts);
outfile.put(' ');
outfile.put(pct);
gr=grade(&pts);
outfile.put(' ');
outfile.put(gr);
}
return 0;
}

PROGRAM 2

//With slight modifications in program 1

#include <iostream.h>
#include <fstream.h>

char add_pts(char ex,char tot, char mi,char fi, char cl)

{

return (ex+tot+mi+fi+cl);

}
char total_ass(char ass[])
{
int t=0;
for(int i=0;i<8;i++)
t=t+ass[i];
return char(t);
}
char percent(char pts)
{
int p;
p=pts/5;
return char(pts);
}
char grade(char pts,char []count_gr)
{
char gr
if(((pts>90)&&(pts<100))||(pts==100))
{
gr='A';
if((pts==99)||(pts==100))
gr='A+';

else if((pts==90)||(pts==91)))

  gr='A-';

count_gr[0]++;
}
elseif((pts<89)&&(pts>80))
{
gr='B';
if((pts==88)||(pts==89))
gr='B+';

else if((pts==80)||(pts==81)))

  gr='B-';

count_gr[1]++;
}
elseif((pts<79)&&(pts>70))
{
gr='C';
if((pts==78)||(pts==79))
gr='C+

else if((pts==70)||(pts==71)))

  gr='C-';

';
count_gr[2]++;
}
elseif((pts<69)&&(pts>60))
{
gr='D';
if((pts==68)||(pts==69))
gr='D+';

else if((pts==60)||(pts==61)))

  gr='D-';

count_gr[3]++;
}
else
{
gr='F'
count_gr[4]++;
}
return gr;
}

int main()
{
ifstream infile;
infile.open("std_data", iso::nocreate);
ofstream outfile("std_report");
ofstream outfile2("std_summary");
char std_id[9],ex,ass[8],mi,fi,cl,tot,pts,pct,gr,count_gr[5],avg=0,max=0;
while(infile)
{
infile.get(ch);

outfile.put('0');
while(ch!=' ')
{
infile.get(ch);
outfile.put(ch);
std_id.append(ch);
}
outfile.put(' ');
infile.get(ch);
outfile.put(ch);
ex=ch;
outfile.put(' ');
infile.put(ch);
for(int i=0; i<8;i++)
{
infile.get(ch);
ass[i];
outfile.put(ch);
infile.put(ch);
outfile.put(ch);
}
tot=total_ass(ass);
infile.get(ch);
outfile.put(ch);
infile.get(ch);
mi=ch;
outfile.put(ch);
infile.get(ch);
outfile.put(ch);
infile.get(ch);
fi=ch;
outfile.put(ch);
infile.get(ch);
outfile.put(ch);
infile.get(ch);
cl=ch;
outfile.put(ch);
outfile.put(' ');
pts=add_pts(ex,tot,mi,fi,cl);
outfile.put(pts);
pct=percent(pts);
outfile.put(' ');
outfile.put(pct);
gr=grade(pts);
outfile.put(' ');
outfile.put(gr,&count_gr);
avg=avg+pct;
max=max+pts;
  
}
outfile2.put(count_gr[0]);
outfile2.put(' ');
outfile2.put(count_gr[1]);
outfile2.put(' ');
outfile2.put(count_gr[2]);
outfile2.put(' ');
outfile2.put(count_gr[3]);
outfile2.put(' ');
outfile2.put(count_gr[4]);
outfile2.put(' ');
outfile2.put(avg);
outfile2.put(' ');
outfile2.put(max);
outfile2.put(' ');
  
return 0;
}

As the question is too big I utilized my time in writting the programs including all the rules/ specifications mentioned in the question. Total marks is not given hence I took it as 500, you may change as you wish. likewise where required information is missing I assumed values of my own, please do replace with your values.

I dont have enough time to explain the code, hope you understand.

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