C++. I need to alter this code below to the current specifications.
Console
Progressing Complete!!!
Specifications
#include <iostream>
#include <string>
#include <iomanip>
#include <fstream>
using namespace std;
const double HOMEWORK_Weight = 0.55;
const double Midterm_Weight = 0.20;
const double Final_Weight = 0.25;
const string FILL = "==========";
int main()
{
//Declare Variables
ifstream inFile;
ofstream outFile;
string firstName, lastName, level ;
double homework1, homework2, homework3, homework4, homework5,
homework6, homework7, homework8, homework9, homework10;
string fillLine = FILL + FILL + FILL + FILL + FILL + FILL;
int absent,present;
int homeworkAvg;
int finalGrade;
int midterm;
int finalExam;
inFile.open("test.in");
outFile.open("report.out");
outFile << fixed << showpoint <<
setprecision(2);
inFile >> firstName >> lastName >> level >>
homework1 >> homework2 >> homework3 >> homework4
>> homework5 >> homework6 >> homework7 >>
homework8 >> homework9 >> homework10 >> midterm
>> finalExam;
homeworkAvg = (homework1 + homework2 + homework3 + homework4 +
homework5 + homework6 + homework7 + homework8 + homework9 +
homework10) / 10;
finalGrade = (homeworkAvg * HOMEWORK_Weight) + (midterm *
Midterm_Weight) + (finalGrade * Final_Weight);
outFile << left;
outFile << fillLine << endl;
outFile << "|" << setw(10) << "Student"
<<"|"<< setw (20) << lastName + "," + firstName
<< "|";
outFile << "|" << setw(10) << "Grade Level"
<< "|" << setw(10) << level << "|" <<
endl;
outFile << fillLine << endl;
outFile << "|" << left << setw(10) <<
"Present" << "|" << right << setw(7) <<
present << "-" << (static_cast<double>(present) /
static_cast<double>(present + absent)) * 100 <<
"%";
outFile << "|" << left << setw(10) <<
"Absent" << "|" << right << setw(7) <<
absent << "-" << (static_cast<double>(absent) /
static_cast<double>(absent + present)) * 100 << "%
|"<< endl;
outFile << fillLine << endl;
outFile << "|" << setw(25) << left <<
"Homework Grades" << setw(20) << "|Average" <<
"|" << setw(13) << right << homeworkAvg <<
"|" << endl;
outFile << fillLine << endl;
outFile << "|" << setw(25) << left << "
Assignment 1" << "|" << setw(19) << right
<< homework1 << "|" << setw(13) << "|"
<< endl;
outFile << "|" << setw(25) << left << "
Assignment 2" << "|" << setw(19) << right
<< homework2 << "|" << setw(13) << "|"
<< endl;
outFile << "|" << setw(25) << left << "
Assignment 3" << "|" << setw(19) << right
<< homework3 << "|" << setw(13) << "|"
<< endl;
outFile << "|" << setw(25) << left << "
Assignment 4" << "|" << setw(19) << right
<< homework4 << "|" << setw(13) << "|"
<< endl;
outFile << "|" << setw(25) << left << "
Assignment 5" << "|" << setw(19) << right
<< homework5 << "|" << setw(13) << "|"
<< endl;
outFile << "|" << setw(25) << left << "
Assignment 6" << "|" << setw(19) << right
<< homework6 << "|" << setw(13) << "|"
<< endl;
outFile << "|" << setw(25) << left << "
Assignment 7" << "|" << setw(19) << right
<< homework7 << "|" << setw(13) << "|"
<< endl;
outFile << "|" << setw(25) << left << "
Assignment 8" << "|" << setw(19) << right
<< homework8 << "|" << setw(13) << "|"
<< endl;
outFile << "|" << setw(25) << left << "
Assignment 9" << "|" << setw(19) << right
<< homework9 << "|" << setw(13) << "|"
<< endl;
outFile << "|" << setw(25) << left << "
Assignment 10" << "|" << setw(19) << right
<< homework10 << "|" << setw(13) << "|"
<< endl;
outFile << fillLine << endl;
outFile << "|" << setw(25) << left <<
"Midterm Grade:" << setw(20) << "|" << "|"
<< setw(12) << right << midterm << "|"
<< endl;
outFile << fillLine << endl;
outFile << "|" << setw(25) << left <<
"Final Exam Grade" << setw(20) << "|" << "|"
<< setw(12) << right << finalGrade << "|"
<< endl;
outFile << fillLine << endl;
outFile << "|" << setw(25) << left <<
"Course Grade:" << setw(20) << "|" << "|"
<< setw(12) << right << finalGrade << "|"
<< endl;
inFile.close();
outFile.close();
return 0; }
#include <iostream> #include <string> #include <iomanip> #include <fstream> using namespace std; const double HOMEWORK_Weight = 0.55; const double Midterm_Weight = 0.20; const double Final_Weight = 0.25; const string FILL = "=========="; void printReport(ofstream& outFile,string firstName,string lastName,int absent,int present,double homework[], int homeWorkSum,int homeworkAvg,int finalGrade,int midterm,int finalExam,string level){ outFile << fixed << showpoint << setprecision(2); string fillLine = FILL + FILL + FILL + FILL + FILL + FILL; outFile << left; outFile << fillLine << endl; outFile << "|" << setw(10) << "Student" <<"|"<< setw (20) << lastName + "," + firstName << "|"; outFile << "|" << setw(10) << "Grade Level" << "|" << setw(10) << level << "|" << endl; outFile << fillLine << endl; outFile << "|" << left << setw(10) << "Present" << "|" << right << setw(7) << present << "-" << (static_cast<double>(present) / static_cast<double>(present + absent)) * 100 << "%"; outFile << "|" << left << setw(10) << "Absent" << "|" << right << setw(7) << absent << "-" << (static_cast<double>(absent) / static_cast<double>(absent + present)) * 100 << "% |"<< endl; outFile << fillLine << endl; outFile << "|" << setw(25) << left << "Homework Grades" << setw(20) << "|Average" << "|" << setw(13) << right << homeworkAvg << "|" << endl; outFile << fillLine << endl; outFile << "|" << setw(25) << left << " Assignment 1" << "|" << setw(19) << right << homework[1] << "|" << setw(13) << "|" << endl; outFile << "|" << setw(25) << left << " Assignment 2" << "|" << setw(19) << right << homework[2] << "|" << setw(13) << "|" << endl; outFile << "|" << setw(25) << left << " Assignment 3" << "|" << setw(19) << right << homework[3] << "|" << setw(13) << "|" << endl; outFile << "|" << setw(25) << left << " Assignment 4" << "|" << setw(19) << right << homework[4] << "|" << setw(13) << "|" << endl; outFile << "|" << setw(25) << left << " Assignment 5" << "|" << setw(19) << right << homework[5] << "|" << setw(13) << "|" << endl; outFile << "|" << setw(25) << left << " Assignment 6" << "|" << setw(19) << right << homework[6] << "|" << setw(13) << "|" << endl; outFile << "|" << setw(25) << left << " Assignment 7" << "|" << setw(19) << right << homework[7] << "|" << setw(13) << "|" << endl; outFile << "|" << setw(25) << left << " Assignment 8" << "|" << setw(19) << right << homework[8]<< "|" << setw(13) << "|" << endl; outFile << "|" << setw(25) << left << " Assignment 9" << "|" << setw(19) << right << homework[9] << "|" << setw(13) << "|" << endl; outFile << "|" << setw(25) << left << " Assignment 10" << "|" << setw(19) << right << homework[10] << "|" << setw(13) << "|" << endl; outFile << fillLine << endl; outFile << "|" << setw(25) << left << "Midterm Grade:" << setw(20) << "|" << "|" << setw(12) << right << midterm << "|" << endl; outFile << fillLine << endl; outFile << "|" << setw(25) << left << "Final Exam Grade" << setw(20) << "|" << "|" << setw(12) << right << finalGrade << "|" << endl; outFile << fillLine << endl; outFile << "|" << setw(25) << left << "Course Grade:" << setw(20) << "|" << "|" << setw(12) << right << finalGrade << "|" << endl; } int main() { //Declare Variables ifstream inFile; ofstream outFile; string firstName, lastName, level ; //double homework1, homework2, homework3, homework4, homework5, homework6, homework7, homework8, homework9, homework10; double homework[11]; //ignoring the 0 index. string fillLine = FILL + FILL + FILL + FILL + FILL + FILL; int absent,present; int homeWorkSum; int homeworkAvg; int finalGrade; int midterm; int finalExam; inFile.open("test.in"); outFile.open("report.out"); inFile >> firstName >> lastName >> level; // looping to fill the homework array. for (int i = 1; i <=10; i++) { inFile >> homework[i]; // calculating sum of homework marks homeWorkSum += homework[i]; } inFile >> midterm >> finalExam; //homeworkAvg = (homework1 + homework2 + homework3 + homework4 + homework5 + homework6 + homework7 + homework8 + homework9 + homework10) / 10; homeworkAvg = homeWorkSum/10; finalGrade = (homeworkAvg * HOMEWORK_Weight) + (midterm * Midterm_Weight) + (finalGrade * Final_Weight); printReport(outFile,firstName,lastName,absent,present,homework,homeWorkSum,homeworkAvg,finalGrade,midterm,finalExam,level); inFile.close(); outFile.close(); return 0; }
According to the given specifications,the changes made are:
A homework array of size 10 is initialized and loaded through a for loop from input file.Also, sum of each homework marks are simultaneously by adding each element of array to homeworksum variable.
A new function for printing report is created and necessary
variables are passed including the homework array.


C++. I need to alter this code below to the current specifications. Console Progressing Complete!!! Specifications...
(C++) I need to alter the code below to fit the given requirements. You will need to move the calculations to a function. A second function to return the Letter Grade. You will need to define a namespace to contain the CONST. Also, need to define an enum for letter grades: A, B, C, D, and F. Console Student Grade Calculation Form First Name: Larry Last Name: Hobbs Homework Average: 65 Midterm Grade: 90 Final Exam Grade: 75 Student: Larry...
I want to change this code and need help. I want the code to not use parallel arrays, but instead use one array of struct containing the data elements, String for first name, String for last name,Array of integers for five (5) test scores, Character for grade. If you have any idea help would be great. #include #include #include #include using namespace std; const int NUMBER_OF_ROWS = 10; //number of students const int NUMBER_OF_COLUMNS = 5; //number of scores void...
Please program in C++ and document the code as you go so I can understand what you did for example ///This code does~ Your help is super appreciated. Ill make sure to like and review to however the best answer needs. Overview You will revisit the program that you wrote for Assignment 2 and add functionality that you developed in Assignment 3. Some additional functionality will be added to better the reporting of the students’ scores. There will be 11...
Need help with C++ assignment
Assignment 1 and .txt files are provided at the
bottom.
PART A
PART B
Assignment
1
#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <algorithm>
using namespace std;
/**
This structure is to store the date and it has three integer
fields
**/
struct Date{
int day;
int month;
int year;
};
/**
This structure is to store the size of the box and it...
C++ Programming
Hi! Sorry for all the material attached. I simply need help in
writing the Facility.cpp file and the other files are included in
case they're needed for understanding. I was able to complete the
mayday.cpp file but am stuck on Facility. The following link
contains a tar file with the files provided by the professor. Thank
you so much in advanced!
http://web.cs.ucdavis.edu/~fgygi/ecs40/homework/hw4/
Closer.h:
#ifndef CLOSER_H
#define CLOSER_H
#include <string>
#include "gcdistance.h"
struct Closer {
const double latitude, longitude;...
Name: True/False & Multiple Choice (2 points each) (True / False ) 2 A char literal '2', a string literal "2", and the numeric literal 2 are identical and stored the same way though they are different types. 3 Since comments do not affect the program execution, you don't need to have it at all. 4. After the following statements are executed, the value of the variable rem is 3. 1. A preprocessor directive line starts with a pound sign...
I
need help writing this code in C++
Proj11.cpp is provided as well as the randomdata.txt
thank you in advance!
Objectives: The main objectives of this project is to introduce you to recursion, and test your ability to work with some STL functionalities. A review of your knowledge on working with templates, dynamic data structures, as well as manipulating dynamic memory, classes, pointers and iostream to all extents, is also included. Description: For the entirety of this project, you will...
I NEED HELP WITH THIS HOMEWORK!!!! What is a characteristic of a bag data type? Elements are added and removed in any order Elements are removed in the same order they were added Distinct elements are added in any order but are removed beginning with the last one added Distinct elements are removed in the reverse order they were added Which scenario illustrates a data stack structure Standing in a line to be serviced Filing documents in alphabetical order Offering...