Problem Specification:
Write a C++ program to calculate student’s GPA for the semester in
your class. For each student,
the program should accept a student’s name, ID number and the
number of courses he/she is
taking, then for each course the following data is needed
the course number a string e.g. BU 101
course credits “an integer”
grade received for the course “a character”.
The program should display each student’s information and their
courses information. It should
also display the GPA for the semester. The scale for each grade
would be
A 4 points
B 3 points
C 2 points
D 1 points
F 0 points
Print out the complete information including the GPA. You may
read the data from a file and send your
output to a file.
Note that the students are not taking the same number of courses;
also note that the number of credits may
vary for each of the courses.
Requirements:
Define a class for course information, private data members are
course number, number of
credits, and the grade earned for the course.
Define another class for the student, private data members are
the student name, ID number,
number of courses, GPA, and a vector of course information defined
above.
you may write one or multiple mutator functions to read the data
for each class
Each class is defined in a header file and implemented in
another.
Your client file, defines an array of student objects. To test
your program, make the array size
2 or 3 student objects, with various number of courses, credits per
course and grades.
Output the report as specified above and shown below.
Comment thoroughly and use specifications for every function.
Sample output:
&~&~&~&~&~&~&~&~&~&~&~&~
Students GPA report
Fall 2018 Semester
&~&~&~&~&~&~&~&~&~&~&~&~
ID# .....# of
courses......Course....Grade....Credits.......GPA
1234...... (4)....................(1)...........(A)..........
(3)
......................................(2)............(B)..........(4)
.......................................(3)............(C)..........(3)
.......................................(4)............(D)..........(2)...........(2.66)
2345........3......................1...............C............2
.........................................(:)
.........................................(:)
.........................................(:)
Grading criteria:
5 points Proper spacing, comments, and general program
appearance.
20 points classes are defined properly and correctly.
5 points guards are used for every class.
10 points class diagrams are included.
10 points all accessor methods are constant and all parameters are
constant reference.
10 points an implementation file for each class includes all member
functions for the class.
10 points every function has full specifications.
5 points an array of objects is defined in the client.
10 points a vector of course info is defined as a data member in
the student’s class.
10 points Program design and implementation are as specified.
5 points test data, result of run, diagrams, and source are
submitted.
Submission Details:
Submit a print-out of:
The source file
A copy of your input data
A copy of the output file.
CODE:
student.h:
#define STUDENT_H
#include "course.h"
#include
#include
#include
using namespace std;
class Student
{
private:
string Name;
int ID;
int number_of_courses;
float GPA;
vector
public:
void setName(string n)
{
Name=n;
}
string getName()
{
return Name;
}
void setID(int i)
{
ID=i;
}
int getID()
{
return ID;
}
void setNumber_Of_Courses(int n)
{
number_of_courses=n;
}
int getNumber_Of_Courses()
{
return number_of_courses;
}
void setGPA(float g)
{
GPA=g;
}
float getGPA()
{
return GPA;
}
void setDetails(vector
{
details=c;
}
vector
{
return details;
}
};
#endif // STUDENT_H
Course class header file
course.h
#ifndef COURSE_H
#define COURSE_H
#include
#include
#include
using namespace std;
class Course
{
private:
string course_no;
int number_of_credits;
string grade;
public:
void setCourse_No(string c)
{
course_no=c;
}
string getCourse_No()
{
return course_no;
}
void setNumber_Of_Credits(int n)
{
number_of_credits=n;
}
int getNumber_Of_Credits()
{
return number_of_credits;
}
void setGrade(string g)
{
grade=g;
}
string getGrade()
{
return grade;
}
};
#endif // COURSE_H
Client file program.cpp
#include
#include
#include
#include
#include "course.h"
#include "student.h"
using namespace std;
int main()
{
Student st[2];
/*Storing details of student 1 in the objects*/
st[0].setName("John");
st[0].setID(1234);
st[0].setNumber_Of_Courses(4);
vector
student1[0].setCourse_No("1");
student1[0].setNumber_Of_Credits(3);
student1[0].setGrade("A");
student1[1].setCourse_No("2");
student1[1].setNumber_Of_Credits(4);
student1[1].setGrade("B");
student1[2].setCourse_No("3");
student1[2].setNumber_Of_Credits(3);
student1[2].setGrade("C");
student1[3].setCourse_No("4");
student1[3].setNumber_Of_Credits(2);
student1[3].setGrade("D");
st[0].setDetails(student1);
/*Storing details of student 2 in the objects*/
st[1].setName("Paul");
st[1].setID(2345);
st[1].setNumber_Of_Courses(3);
vector
Course c5,c6,c7;
student2[0].setCourse_No("1");
student2[0].setNumber_Of_Credits(2);
student2[0].setGrade("C");
student2[1].setCourse_No("2");
student2[1].setNumber_Of_Credits(4);
student2[1].setGrade("B");
student2[2].setCourse_No("3");
student2[2].setNumber_Of_Credits(2);
student2[2].setGrade("D");
st[1].setDetails(student2);
/*Defining an array containing numerical value of grades*/
int number_grade[5]={4,3,2,1,0};
float temp=0;
float sum_of_credits;
for(int i=0;i<2;i++)
{
vector
float x,y;
sum_of_credits=0;
temp=0;
for(int j=0;j
x=details[j].getNumber_Of_Credits();
y=number_grade[details[j].getGrade()[0]-65];
temp+=(x*y);
sum_of_credits+=x;
}
float gpa=temp/sum_of_credits;
st[i].setGPA(gpa);
}
/*Display the results*/
cout<<"------------------------------------------------------------------------------------------------------------------"<
{
vector
cout<
for(j=0;j
cout<<" "<
cout<<" "<
return 0;
}
OUTPUT:
Problem Specification: Write a C++ program to calculate student’s GPA for the semester in your class. For each student, the program should accept a student’s name, ID number and the number of courses...
Program 5 Due 10/25 C-String and Two-dimensional Array Use An input data file starts with a student's name (on one line). Then, for each course the student took last semester, the file has 2 data lines. The course name is on the first line. The second line has the student's grade average (0 to 100) and the number of credits for the course Sample data: Jon P. Washington, Jr. Computer Science I 81 4 PreCalculus 75 3 Biology I 88...
You will create a class to store information about a student�s courses and calculate their GPA. Your GPA is based on the class credits and your grade. Each letter grade is assigned a point value: A = 4 points B = 3 points C = 2 points D = 1 point An A in a 3 unit class is equivalent to 12 grade points (4 for the A times 3 unit class) A C in a 4 unit class is...
(7) Student grade point statistics [Problem description] There is a need to make statistics of the grade points of the students in the first semester of 2018. It is assumed that there are n (can be set as 6) classes in this grade, and there are 20 students in each class, the total number of courses with exam is m (can be set as 10), and the percentage system is adopted for each course. The gpa is 4, 3, 2,1,...
Please help me to write a program in C++ with comments and to
keep it simple as possible. Also, post the output please.
Thank you!
Here is input data:
2333021 BOKOW, R. NS201 3 A
2333021 BOKOW, R. MG342 3 A
2333021 BOKOW, R. FA302 1 A
2574063 FALLIN, D. MK106 3 C
2574063 FALLIN, D. MA208 3 B
2574063 FALLIN, D. CM201 3 C
2574063 FALLIN, D. CP101 2 B
2663628 KINGSLEY, M. QA140 3 A
2663628 KINGSLEY, M....
A. Create a CollegeCourse class. The class contains fields for the course ID (for example, CIS 210), credit hours (for example, 3), and a letter grade (for example, A). Include get and set methods for each field. Create a Student class containing an ID number and an array of five CollegeCourse objects. Create a get and set method for the Student ID number. Also create a get method that returns one of the Student’s CollegeCourses; the method takes an integer...
A. Create a CollegeCourse class. The class contains fields for the course ID (for example, CIS 210), credit hours (for example, 3), and a letter grade (for example, A). Include get and set methods for each field. Create a Student class containing an ID number and an array of five CollegeCourse objects. Create a get and set method for the Student ID number. Also create a get method that returns one of the Student’s CollegeCourses; the method takes an integer...
A. Create a CollegeCourse class. The class contains fields for the course ID (for example, CIS 210), credit hours (for example, 3), and a letter grade (for example, A). Include get and set methods for each field. Create a Student class containing an ID number and an array of five CollegeCourse objects. Create a get and set method for the Student ID number. Also create a get method that returns one of the Student’s CollegeCourses; the method takes an integer...
Java Description You are given the task of reading a student’s name, semester letter grades, and semester hours attempted from one file; calculating the semester GPA; and writing the student’s name and semester GPA to another file. GPA Calculation GPA = Total Quality Points / Hours Attempted Quality Points for each class = Grade Conversion Points * Hours Attempted The letter grades with corresponding point conversions is based upon the following table: Letter Grade Conversion Points A 4 points B...
Design and code a JAVA program called ‘Grades’. ? Your system should store student’s name, and his/her course names with grades. ? Your system should allow the user to input, update, delete, list and search students’ grades. ? Each student has a name (assuming no students share the same name) and some course/grade pairs. If an existing name detected, user can choose to quit or to add new courses to that student. ? Each student has 1 to 5 courses,...
Student(Student number, student name, semester) Course(Course number, course name, credits, transfer credits) PART A: Using above BS in MIS degree requirements, perform the following (25 points) Develop tables (provide create statements) Normalize them (make sure they are in 3rd NF) Draw a single ERD – clearly identify Primary and Foreign keys (state any assumptions made) (10 points) Create following views: (5 points) Create a view that would list all MIS required courses Create a view that will give a total...