Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

An immaculate table or diagram is required. Provide an ideal solution immediately. Strict warning: AI is strictly banned. BR 2 0 / * Name:

An immaculate table or diagram is required. Provide an ideal solution immediately. Strict warning: AI is strictly banned.
BR20
"/*
Name:
Class:
Date:
Discription:
*/
include
include
using namespace std;
void input(string& name, int& id, int& numCourses);
void inputCourse(string& courseNumber, int& credits, char& grade);
double calculateGPA(int totalPoints, int totalCredits);
char gradeToPoints(char grade);
void output(string name, int id, int totalCredits, double gpa);
const int MAX_COURSES =5;
const char GRADES[]={'A','B','C','D','F'};
const double POINTS[]={4.0,3.0,2.0,1.0,0.0};
int main(){
ofstream outFile;
outFile.open(""GPA_Report.txt"");
// Print header
outFile <<""&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~
""
<<""\tCommunity College
""
<<""\tCIS 160 Students GPA report
""
<<""\tSpring 2023 Semester
""
<<""\&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~&~
"";
char repeat;
do {
string name;
int id, numCourses, totalCredits =0, totalPoints =0;
input(name, id, numCourses);
outFile <<""Name: ""<< name <<""\tID #: ""<< id << endl;
for (int i =1; i <= numCourses; i++){
string courseNumber;
int credits;
char grade;
inputCourse(courseNumber, credits, grade);
totalCredits += credits;
totalPoints += gradeToPoints(grade)* credits;
}
double gpa = calculateGPA(totalPoints, totalCredits);
output(name, id, totalCredits, gpa);
cout <<""Do you want to process another student? (Y/N): "";
cin >> repeat;
} while (toupper(repeat)=='Y');
outFile.close();
cout <<""Output written to GPA_Report.txt
"";
return 0;
}
void input(string& name, int& id, int& numCourses){
cout <<""Enter student name: "";
getline(cin, name);
bool validID = false;
while (!validID){
cout <<""Enter student ID (0-9999): "";
cin >> id;
validID =(id >=0 && id <=9999);
if (!validID){
cout <<""Invalid ID number. "";
}
}
bool validNumCourses = false;
while (!validNumCourses){
cout <<""Enter number of courses (1-5): "";
cin >> numCourses;
validNumCourses =(numCourses >=1 && numCourses <= MAX_COURSES);
if (!validNumCourses){
cout <<""Invalid number of courses. "";
}
}
cin.ignore();
}
void inputCourse(string& courseNumber, int& credits, char& grade)
not sure what's wrong with the code or how to even fix it but these are its requirements:
Write a C++ program to calculate a students GPA for the semester. The program should accept a students name, the ID number and the number of courses he/she is taking. For each course the following data is needed
the course number a string e.g. CIS 160
the course credits an integer e.g.4
the final grade received for the course a character. e.g. A
E tatau i le polokalame ona tusi i se faila le igoa o le tamaititi aoga, numera ID, le aofai o maka o loo ave e le tamaititi aoga, ma tamaiti aoga Grade Point Average (GPA) mo le semesa. E tatau ona aofia ai se fe'au lapata'i i le galuega faatino pe afai o le GPA e itiiti ifo i le 2.0 ma se fe'au fa'amalo pe afai o le GPA e 3.0 pe sili atu. O le lipoti o le a lolomi se laina se tasi mo tamaiti aoga taitasi. Siaki i lalo le auala e sue ai le gpa mo se tamaititi aoga

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M Ricardo, Susan D Urban

3rd Edition

1284056945, 9781284056945

More Books

Students also viewed these Databases questions

Question

What are the different categories of hedge funds?

Answered: 1 week ago

Question

Explain the process of MBO

Answered: 1 week ago

Question

1. Who is your target audience? (everyone cannot be an answer here)

Answered: 1 week ago

Question

What problems have created the client's needs?

Answered: 1 week ago

Question

create simple design pieces exhibiting visual and rhetorical focus.

Answered: 1 week ago