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...

  • 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...

  • 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...

  • please use the c language Assignment 12 The program to write in this assignment is a...

    please use the c language Assignment 12 The program to write in this assignment is a program that calculates score statistics and manages the grades of the students. First, the student list and are given in a file named "student.dat" as in the following: 이성우 77 홍길동 88 scores 201 1710086 2012700091 This program reads the input file "student.dat" and keeps this data in a linear linked list. Each node must be a struct which contains the following: student id...

  • Create a Student grading system. You should use a person base class (stores the name of...

    Create a Student grading system. You should use a person base class (stores the name of the student). Derive a student class from the person class. The student class stores the student ID. The student class should also store the students 3 exams (Test 1, Test 2, and Test 3) and calculate a final grade (assume the 3 tests count equally). Create an array of students for a class size of 15 students. You can use the keyboard to read...

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
ADVERTISEMENT