Question

A continuation of your grading software will be made you do not need your other code for this assignment). In this one you wi
Quintin Donnelly Justin Nunez
103 102 150 90 93.4 93.2

C++ Language
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code:-

#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
using namespace std;
#define MAX_STUDENT 100
char getGrade(float grade)
{
   if(grade >= 90)
{
   return 'A';
}
else if(grade >= 80)
{
   return 'B';
}
else if(grade >= 70)
{
   return 'C';
}
else if(grade >= 60)
{
    return 'D';
}
else
{
return 'F';
}
}
int main()
{
ofstream outfile;
outfile.open("report.txt");
ifstream infile("students.txt");
string firstName[MAX_STUDENT], lastName[MAX_STUDENT];
float grade[MAX_STUDENT];
string first,last;
int count=0,index=0;
while (infile >> first >> last)
{
   firstName[count]=first;
lastName[count]=last;
count++;
}
ifstream infile2("grades.txt");
float gradeA,gradeB,gradeC;
while (infile2 >> gradeA >> gradeB >> gradeC)
{
grade[index]=(gradeA+gradeB+gradeC)/3;
index++;
}
for(index=0;index<count;index++)
{
if(grade[index]>100)
   {
   outfile <<lastName[index]<<", "<<firstName[index]<<" Teacher was far too easy"<<endl;
}
   else
   {
        outfile <<lastName[index]<<", "<<firstName[index]<<" "<<getGrade(grade[index])<<endl;
}
}
outfile.close();
system("pause");
return 0;
}

Input Files:-

students.txt

Quintin Donnelly
Justin Nunez

grades.txt

103 102 150
90 93.4 93.2

Code Screenshots:-

1 2 3 4 5 6 7 #include <iostream> #include <sstream> #include <fstream> #include <string> using namespace std; #define MAX_ST42 43 30 int main() 31 = { 32 ofstream outfile; 33 outfile.open(report.txt); 34 ifstream infile(students.txt); string fir

Output:-

report.txt

Donnelly, Quintin Teacher was far too easy
Nunez, Justin A

Please UPVOTE thank you...!!!

Add a comment
Know the answer?
Add Answer to:
C++ Language A continuation of your grading software will be made you do not need your...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • A continuation of your grading software will be made (you do not need your other code...

    A continuation of your grading software will be made (you do not need your other code for this assignment). In this one you will intake a students first name and last name from a file called "students.txt". Next, there is a file called grades.txt that contains the grades in a course. There will be three grades for each student in "grades.txt" (see example file bellow). In "student.txt" there are two students first and last names. In "grades.txt" the grades for...

  • First, create two inputs that can be stored in variables consisting of a student's name. When...

    First, create two inputs that can be stored in variables consisting of a student's name. When the program begins ask "Who is the first student?" followed by "Who is the second student?" You only have to have two students for this program. Ask the user for the scores for the last three test grades for each of the students .   After the user has entered both names, and three scores for each, the program should display the following as output:...

  • You must assume that the data file and your four function subprograms are located inside the working directory (forder). Please write the main program and each of the four function subprograms. 1. Th...

    You must assume that the data file and your four function subprograms are located inside the working directory (forder). Please write the main program and each of the four function subprograms. 1. The data in the following table are to be read from the file "grades.txt"and processed The grades are in percentages. The format of the data is shown below First Name ID Number Last Name Grades 001AA Tam 78.50 oe 86.45 001AB Gabriel Stuart Thus, there are 4 columns...

  • Java Gradebook

    Requirements:1.     The number of students to enter will be dynamic, minimum of 5.2.     Ask the user for a student's:a.     first nameb.     last namec.      student IDd.     4 exam grades (each out of 100 points)Calculate the student's:e.     final letter grade.3.     For each student, if the user enters invalid data he will be allowed to enter it again.4.     Letter grade calculation will use the standard grading scale.a.     90% - 100% = Ab.     80% - 89% = Bc.      70% - 79% = Cd.     60% - 69% = De.     Below 60% = F5.     The output will consist of:a.     A list of...

  • Java - In NetBeans IDE: • Create a class called Student which stores: - the name...

    Java - In NetBeans IDE: • Create a class called Student which stores: - the name of the student - the grade of the student • Write a main method that asks the user for the name of the input file and the name of the output file. Main should open the input file for reading . It should read in the first and last name of each student into the Student’s name field. It should read the grade into...

  • IN C You will be creating a program to help a teacher calculate final grades for...

    IN C You will be creating a program to help a teacher calculate final grades for a class. The program will calculate a final letter grade base on a standard 90/80/70/60 scale. You will be taking input from a file that contains all of the names and grades of each student. You will find the average for each student and output each student's final letter grade. Your program should accept the filename from the command-line Add error checking to make...

  • Write a Java program that reads a file until the end of the file is encountered....

    Write a Java program that reads a file until the end of the file is encountered. The file consists of an unknown number of students' last names and their corresponding test scores. The scores should be integer values and be within the range of 0 to 100. The first line of the file is the number of tests taken by each student. You may assume the data on the file is valid. The program should display the student's name, average...

  • PYTHON 3 Object Oriented Programming ***a9q3.py file below*** class GradeItem(object): # A Grade Item is anything...

    PYTHON 3 Object Oriented Programming ***a9q3.py file below*** class GradeItem(object): # A Grade Item is anything a course uses in a grading scheme, # like a test or an assignment. It has a score, which is assessed by # an instructor, and a maximum value, set by the instructor, and a weight, # which defines how much the item counts towards a final grade. def __init__(self, weight, scored=None, out_of=None): """ Purpose: Initialize the GradeItem object. Preconditions: :param weight: the weight...

  • To answer this question you must submit a fully functional "C" program, this is your "main.c"...

    To answer this question you must submit a fully functional "C" program, this is your "main.c" file. This is the content of the Grades.txt file (download here) Adam 4.00 7.00 9.00 10.00 Catherine 10.00 8.00 1.00 9.00 John 10.00 9.00 7.50 6.50 Pedro 10.00 9.00 7.50 9.00 Wanda 9.00 6.50 4.50 10.00 In the file Grades.txt you will find that each line contains the name of a student and his 4 grades for the current term. Create a C program...

  • C programming. 1.Create a program that does the following - Creates three pointers, a character pointer...

    C programming. 1.Create a program that does the following - Creates three pointers, a character pointer professor, and two integer pointers student_ids, grades - Using dynamic memory, use calloc to allocate 256 characters for the professor pointer - Prompts the professor for their name, and the number of students to mark. - Stores the professor’s name using the professor pointer and in an integer the number of students to mark. - Using dynamic memory, use malloc to allocate memory for...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT