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

make a visual basic program #include \"stdafx.h\" #include <iostream> #include <

ID: 3698617 • Letter: M

Question

make a visual basic program
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std

ASSIGNMENT 28 Write a program [YourNamel-Assignment2B (replace [YourName] with your actual name, no spaces) that reads from a file (with variable number of records) student names and the grades for 2 tests (the points are floating- point numbers between O and 100) (format: Name for each student the overall total points for all tests (column Total Points) 1 the numeric grade (column Numeric Grade)2 (between 0 and 100) and the letter grade (column Letter Grade). The program should also compute and output the number of students (row Number), and average numeric grade (row Average) among all students and displays them with 2 decimals. Display the output in the exact format shown below (use 2 decimals for floating-point numbers and the columns and alignment suggested bellow Sample input data file: Testl Test2) and determines and outputs Sample console output: STUDENT STATISTICS TotalNunericLetter Pointa Name Grade 3 Grade Anderson1 71 2585.63 Blake165:00 castiIio135:0067.50 Dang Engberg ::::180.00 , 90.00 Anderson Blake Casti110 Dang Engberg Fu Garcia Eung Iona Johnson 905 80.75 90 80 85 100 5590-5 ?? 60 60 75 1800090:00 95 80 Garcia189 00 iing Tona Johnson CLASS ESTATISTICS 9500 94.30 4150 35 60.75 65 120.250 105.00 10 Averege 94 50 Your program should work on the Grades xt (from the assignment" do NOT change the name of the file or edit the file) and any other files that have the correct format, thus, do not hardcode the output or the number of students For 10 extra credit points, compute the minimum and maximum of the numeric grades and output them the CLASS STATISTICS table.

Explanation / Answer

Solution:

code:

#include<iostream> //Header files

#include<stdlib.h>

#include<iomanip>

#include<fstream>

//Namespace declaration

using namespace std;

//Starting of main function

int main()

{

//setting the precision to 2 decimal points

cout<<fixed<<setprecision(2)<<endl;

//Varibale data type declaration

string name;

double test1, test2;

float max, min, total_avg=0,Avg;

float N_Grades;

char L_Grade;

float Grades[100];

float TOTAL[100];

int i=0;

float total;

int count;

ifstream infile;

//open input.txt file for reading

infile.open("Grades.txt");

//error checking

if(!infile)

{

cout<<"Error in reading the file. ";

exit(0);

}

//setting the header
cout<<endl;

cout<<"STUDENT STATICS: "<<endl;

cout<<endl;

cout<<setw(20)<<left<<"Name"<<setw(20)<<left<<"Total Points"<<setw(20)<<left<<"Numeric Grade"<<setw(20)<<left<<"Letter Grade"<<endl;

cout<<endl;

//reading the data from the file

while(infile>>name>>test1>>test2)

{

//calculating total of tests

total = test1+test2;

//Calculating grades

N_Grades = total/2;

//Assigning Grades to a array to find min and max of the garades

Grades[i] = N_Grades;

//condtion checking and assign the grade according to the match found..

if(N_Grades>=90 && N_Grades<=100)

{

L_Grade = 'A';

}

else if(N_Grades>=80 && N_Grades<=90)

{

L_Grade = 'B';

}

else if(N_Grades>=70 && N_Grades<=80)

{

L_Grade = 'C';

}

else if(N_Grades>=60 && N_Grades<=70)

{

L_Grade = 'D';

}

else

{

L_Grade = 'F';

}

//Display Information

cout<<setw(20)<<left<<name<<setw(20)<<left<<total<<setw(20)<<left<<N_Grades<<setw(20)<<left<<L_Grade<<endl;

i++;

}

cout<<endl;

min = Grades[0];

max = Grades[0];

for(count=0;count < i; count++)

{

//Calculating total of grades

total_avg = total_avg + Grades[count];

//Calculating Avg of grades

Avg = total_avg/i;

}

//Finding min grade

for(count=0;count<i;count++)

{

if(Grades[count]<min)

{

min = Grades[count];

}

}

//finding max grade

for(count=0;count<i;count++)

{

if(Grades[count]>max)

{

max = Grades[count];

}

}

//Display Information

cout<<"CLASS STATICS:"<<endl;

cout<<endl;

cout<<"Number: "<<setw(10)<<right<<i<<endl;

cout<<"Minimum: "<<setw(10)<<right<<min<<endl;

cout<<"Maximum: "<<setw(10)<<right<<max<<endl;

cout<<"Average: "<<setw(10)<<right<<Avg<<endl;

//close files

infile.close();

return 0;

}

I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)