I have been having trouble with this assignment. Attached will ben the assignment guide lines and my code.  Thanks for any help that is offered.  My Code:  #include // Needed for cin and cout #include // Needed for String variables #include   #include // Needed for Input and Output Variables #include // Using namespaces using namespace std; // Constants  const string FILL = "=========="; const string RULER = "123456790"; const double AVG = .55; const double MIDTERM = .20; const double FINAL = .25; // Prototype Namespace namespace myNamespace {     //enum     enum scoreLetter {A, B, C, D, F};     //Function Prototypes     double course_grade((homeworkAverage * .55) + (midtermExam * .20) + (finalExam * .25));     myNamespace::scoreLetter score_Letter(int score)     {         return score >= 90 ? myNamespace::A :             score >= 80 ? myNamespace::B :             score >= 70 ? myNamespace::C :             score >= 60 ? myNamespace::D :             myNamespace::F;     }; } int main() {     // Declare stream variables     ifstream inputData;     ofstream outputData;     // input file stream object     std::ifstream file("performance-input.txt");     std::string input;     std::vector data;     // Declare Variables     double homework1, homework2, homework3, homework4, homework5, homework6, homework7, homework8, homework9, homework10;     double midtermExam;     double finalExam;     double present;     double absent;     double homeworkAverage;     double courseGrade;     string rulerLine = RULER + RULER + RULER + RULER + RULER + RULER;     string fillLine = FILL + FILL + FILL + FILL + FILL + FILL;     string firstName;     string lastName;     // Open input file      inputData.open("performance-input.txt");     if (!inputData)     {         cout << "Cannot open input file."             << "Program terminates!" << endl;         return 1;     }     // Open output file     outputData.open("performance - input.out");     outputData << fixed << showpoint << setprecision(2);     inputData >> midtermExam;     inputData >> finalExam;     inputData >> present;     inputData >> absent;     homeworkAverage = (homework1 + homework2 + homework3 + homework4 + homework5 + homework6 + homework7 + homework8 + homework9 + homework10) / 10;     courseGrade = (homeworkAverage * .55) + (midtermExam * .20) + (finalExam * .25);     while (file >> input) // return file performance-input.txt     {         cout << left;         cout << rulerLine << endl << endl;         cout << fillLine << endl;         cout << setw(10) << "| Student" << " | " << setw(21) << lastName + ", "             + firstName << setw(13) << " | Grade Level" << "| " << setw(10) << "|";         cout << endl;         cout << fillLine << endl;         cout << setw(10) << "| Present" << " | " << present << setw(18) << " | Absent" << setw(10) << "|" << absent << setw(17) << "|" << endl;         cout << fillLine << endl;         cout << setw(25) << "| Homework Grades" << " | Average" << setw(19) << " | " << homeworkAverage << setw(12) << "|" << endl;         cout << fillLine << endl;         cout << setw(25) << "| Homework 1" << " | " << homework1 << setw(19) << "|" << setw(12) << "|" << endl;         cout << setw(25) << "| Homework 2" << " | " << homework2 << setw(19) << "|" << setw(12) << "|" << endl;         cout << setw(25) << "| Homework 3" << " | " << homework3 << setw(19) << "|" << setw(12) << "|" << endl;         cout << setw(25) << "| Homework 4" << " | " << homework4 << setw(19) << "|" << setw(12) << "|" << endl;         cout << setw(25) << "| Homework 5" << " | " << homework5 << setw(19) << "|" << setw(12) << "|" << endl;         cout << setw(25) << "| Homework 6" << " | " << homework6 << setw(19) << "|" << setw(12) << "|" << endl;         cout << setw(25) << "| Homework 7" << " | " << homework7 << setw(19) << "|" << setw(12) << "|" << endl;         cout << setw(25) << "| Homework 8" << " | " << homework8 << setw(19) << "|" << setw(12) << "|" << endl;         cout << setw(25) << "| Homework 9" << " | " << homework9 << setw(19) << "|" << setw(12) << "|" << endl;         cout << setw(25) << "| Homework 10" << " | " << homework10 << setw(19) << "|" << setw(12) << "|" << endl;         cout << fillLine << endl;         cout << setw(25) << "| Midterm Grade:" << " | " << setw(19) << "|" << midtermExam << "|" << endl;         cout << setw(25) << "| Final Exam Grade:" << " | " << setw(19) << "|" << finalExam << "|" << endl;         cout << setw(25) << "| Course Grade:" << " | " << setw(19) << "|" << courseGrade << "|" << endl;         cout << fillLine << endl;         inputData.close();     }     int homework[20];     int i;     cout << "Read input data into array";     for (i = 0; i < 20; i++)     {         cin >> homework[i];     }     return 0;  }

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

I have been having trouble with this assignment. Attached will ben the assignment guide lines and my code.  Thanks for any help that is offered. 

My Code: 

#include <iostream> // Needed for cin and cout
#include <string> // Needed for String variables
#include <iomanip> 
#include <fstream> // Needed for Input and Output Variables
#include <vector>

// Using namespaces
using namespace std;

// Constants 
const string FILL = "==========";
const string RULER = "123456790";
const double AVG = .55;
const double MIDTERM = .20;
const double FINAL = .25;

// Prototype Namespace
namespace myNamespace {
    //enum
    enum scoreLetter {A, B, C, D, F};
    //Function Prototypes
    double course_grade((homeworkAverage * .55) + (midtermExam * .20) + (finalExam * .25));
    myNamespace::scoreLetter score_Letter(int score)
    {
        return score >= 90 ? myNamespace::A :
            score >= 80 ? myNamespace::B :
            score >= 70 ? myNamespace::C :
            score >= 60 ? myNamespace::D :
            myNamespace::F;
    };
}

int main()
{
    // Declare stream variables
    ifstream inputData;
    ofstream outputData;

    // input file stream object
    std::ifstream file("performance-input.txt");
    std::string input;
    std::vector<std::string> data;

    // Declare Variables
    double homework1, homework2, homework3, homework4, homework5, homework6, homework7, homework8, homework9, homework10;
    double midtermExam;
    double finalExam;
    double present;
    double absent;

    double homeworkAverage;
    double courseGrade;

    string rulerLine = RULER + RULER + RULER + RULER + RULER + RULER;
    string fillLine = FILL + FILL + FILL + FILL + FILL + FILL;

    string firstName;
    string lastName;

    // Open input file 
    inputData.open("performance-input.txt");

    if (!inputData)
    {
        cout << "Cannot open input file."
            << "Program terminates!" << endl;
        return 1;
    }

    // Open output file
    outputData.open("performance - input.out");
    outputData << fixed << showpoint << setprecision(2);

    inputData >> midtermExam;
    inputData >> finalExam;
    inputData >> present;
    inputData >> absent;

    homeworkAverage = (homework1 + homework2 + homework3 + homework4 + homework5 + homework6 + homework7 + homework8 + homework9 + homework10) / 10;
    courseGrade = (homeworkAverage * .55) + (midtermExam * .20) + (finalExam * .25);

    while (file >> input) // return file performance-input.txt
    {
        cout << left;
        cout << rulerLine << endl << endl;
        cout << fillLine << endl;

        cout << setw(10) << "| Student" << " | " << setw(21) << lastName + ", "
            + firstName << setw(13) << " | Grade Level" << "| " << setw(10) << "|";
        cout << endl;
        cout << fillLine << endl;
        cout << setw(10) << "| Present" << " | " << present << setw(18) << " | Absent" << setw(10) << "|" << absent << setw(17) << "|" << endl;
        cout << fillLine << endl;
        cout << setw(25) << "| Homework Grades" << " | Average" << setw(19) << " | " << homeworkAverage << setw(12) << "|" << endl;
        cout << fillLine << endl;
        cout << setw(25) << "| Homework 1" << " | " << homework1 << setw(19) << "|" << setw(12) << "|" << endl;
        cout << setw(25) << "| Homework 2" << " | " << homework2 << setw(19) << "|" << setw(12) << "|" << endl;
        cout << setw(25) << "| Homework 3" << " | " << homework3 << setw(19) << "|" << setw(12) << "|" << endl;
        cout << setw(25) << "| Homework 4" << " | " << homework4 << setw(19) << "|" << setw(12) << "|" << endl;
        cout << setw(25) << "| Homework 5" << " | " << homework5 << setw(19) << "|" << setw(12) << "|" << endl;
        cout << setw(25) << "| Homework 6" << " | " << homework6 << setw(19) << "|" << setw(12) << "|" << endl;
        cout << setw(25) << "| Homework 7" << " | " << homework7 << setw(19) << "|" << setw(12) << "|" << endl;
        cout << setw(25) << "| Homework 8" << " | " << homework8 << setw(19) << "|" << setw(12) << "|" << endl;
        cout << setw(25) << "| Homework 9" << " | " << homework9 << setw(19) << "|" << setw(12) << "|" << endl;
        cout << setw(25) << "| Homework 10" << " | " << homework10 << setw(19) << "|" << setw(12) << "|" << endl;
        cout << fillLine << endl;
        cout << setw(25) << "| Midterm Grade:" << " | " << setw(19) << "|" << midtermExam << "|" << endl;
        cout << setw(25) << "| Final Exam Grade:" << " | " << setw(19) << "|" << finalExam << "|" << endl;
        cout << setw(25) << "| Course Grade:" << " | " << setw(19) << "|" << courseGrade << "|" << endl;
        cout << fillLine << endl;

        inputData.close();

    }

    int homework[20];

    int i;
    cout << "Read input data into array";

    for (i = 0; i < 20; i++)
    {
        cin >> homework[i];
    }

    return 0; 
}

Specifications
• Included is an input file.
Included is a function to aide, if needed
Use the functions, enum, and namespace defined in Assignment 6.
You will need to use a loop to read each student's data
You will need to load every homework grade into an array
Calculate the homework average
The homework average can be calculated while the array is loaded
Move the printing of the report card into a function and pass the variables read.
This includes passing an array of the homework grades
Fields will include: output file, first name, last name, grade level, homework
array, homework average, midterm exam, final exam, present and absence.
This print function should call the other functions from Assignment 6.
Assume the data in the input files is valid data.
Assignment 7 Function(s)
string AssignmentBuild(int a)
{
ostringstream temp;
temp<<a;
return " Assignment
}
+ temp.str();
Transcribed Image Text:Specifications • Included is an input file. Included is a function to aide, if needed Use the functions, enum, and namespace defined in Assignment 6. You will need to use a loop to read each student's data You will need to load every homework grade into an array Calculate the homework average The homework average can be calculated while the array is loaded Move the printing of the report card into a function and pass the variables read. This includes passing an array of the homework grades Fields will include: output file, first name, last name, grade level, homework array, homework average, midterm exam, final exam, present and absence. This print function should call the other functions from Assignment 6. Assume the data in the input files is valid data. Assignment 7 Function(s) string AssignmentBuild(int a) { ostringstream temp; temp<<a; return " Assignment } + temp.str();
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY