Question
Define a struct calledCoursethat has the componentscode,title,grade(of type string),credit, andcost(of type integer). Define a struct calledFinancethat has the componentstype(of type string), andamount(of type integer). Define
Define a struct calledCoursethat has the componentscode,title,grade(of type string),credit, andcost(of type integer).
Define a struct calledFinancethat has the componentstype(of type string), andamount(of type integer).
Define a class calledStudentthat has private membersid,name,numberOfCourses, the arraylistOfCourses[30] of struct variables of typeCourse,numberOfFinancesof type integer, the arraylistOfFinances[5] of struct variables of typeFinance, andGPAof type float. The class also has the public membersset(string, string),print(),calculateGPA(),findFinance(), and adefault parameterized constructorwith default values \"12345678\" and Omar Ali as the student id and name.
To calculate the tuition fees of each course, multiply the number of credits by the cost of that course.
Save the two structs and the class definitions in the fileStudent.h
Implement the member functions of the class in the fileStudentImp.cpp
Save the following driver in the fileStudent.cpp
int main()
{
Student one;
one.print();
one.set(\"87654321\", \"Ali Omar\");
one.print();
return 0;
}
reading the following data from the filesCourses.txtandFinance.txt
Courses.txt 1501116 Programming I, C+ 4 890 1501211 Programming II, B 3 910 1501115 Data Structures, D+ 3 900 1501365 Advanced Database Systems, C 3 950 | Finance.txt Expenditures 3500 Accommodation 5400 Medical 300 |
produces the following output:
87654321 Ali Omar toke the following courses:
1501116 Programming I 4 890
1501211 Programming II 3 910
1501115 Data Structures 3 900
1501365 Advanced Database Systems 3 950
The GPA was 2.26923 at a cost 21040 dirham
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started