Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

and cost ( of type integer ) . Define a struct called Finance that has the components type ( of type string ) , and

and cost (of type integer).
Define a struct called Finance that has the components type (of type string), and amount (of
type integer).
Define a class called Student that has the following private members:
id and name of type string,
numberOfCourses of type integer,
the array listOfCourses[30] of struct variables of type Course,
numberOfFinances of type integer,
the array listOfFinances[5] of struct variables of type Finance, and
GPA of type float.
The class also has the following public members:
set(string, string), which sets the id and name of a student. It reads the components of
all courses: code, title, grade, credit, and cost from the Courses.txt file into the
listofCourses [] array. It reads the components of all finances: type and amount from
the Finances.txt file into the listOfFinances[] array. The function also keeps track of
the number of courses and number of finances it has read from the files.
print(), which prints the student's information as shown in the output below.
calculate , which calculates the GPA of the student
findFinance(), which calculates the total cost -= total credit cost + total finances. Note
that the cost of each course is equal to the number of credits multiplied by the cost of
each credit of that course, (credit *
default parameterized constructor with default values "12345678" and "Omar Ali" as
the student id and name.
Save the two structs and the class definitions in the file Student.h
Implement the member functions of the class in the file StudentImp cpp
Save the following driver in the file Student cpp
int )
{
Student one:
one.print():
one set("87654321", "Ali Omar"):
one.print():
return 0?
}
Reading the following data from the files Courses.txt and Finance.txt
Produces the following output:
87654321 Ali Omar toke the following courses:
1501116 Programming I ,4,890
1501211 Programming II 3910
1501115 Data Structures ,3,900
1501365 Advanced Database Systems ,3950
The GPA was 2.26923 at a cost 21040 dirham
image text in transcribed

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_2

Step: 3

blur-text-image_3

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

More Books

Students also viewed these Databases questions