Question: [1] Create Student class Student Class Fields gpa double Properties + set absent>> GPA double + Id : int + set absent> Marks : List

 [1] Create Student class Student Class Fields gpa double Properties +

[1] Create Student class Student Class Fields gpa double Properties + set absent>> GPA double + Id : int + set absent> Marks : List + Name : string Methods + AddMark(courseName: string, numberOfCredits: int, grade: int) calculateGpa) : void + constructor Student() + constructor Student (id: int, name: string) Create the following class members: [1] gpa is a private field containing the GPA of a student. [1] GPA is read only property providing the access to the gpa field. [1] Id is auto implemented property representing student id. [1] Name is auto implemented property representing student name. [1] Marks is auto implemented read only property that contains a list of Mark objects. [1] A public parameterless constructor that initialize Marks property. [1] A constructor that takes 2 parameters: student id and the name and assigns their values to appropriates properties. [1] Make sure that there is no code duplication in the constructors. [2] calculateGpa method calculates the student's GPA based on the current marks and assign it to the appropriate class member. GPA is calculated as the sum of weighted grades divided by sum of credits. The weighted grade is calculated by multiplying a course grade by number of the course credits. [2] AddMark method has 3 parameters: course name, number of credits and grade. The method will create the Mark object, assigns the grade to the appropriate property, adds it to the list of marks for a student. Mark object is only added to the list of marks if the grade is assigned, i.e. there is no exception caused by grade outside of range. [1] This method (AddMark) makes the necessary updates to other members of the student object, like recalculating the GPA. [1] Create Student class Student Class Fields gpa double Properties + set absent>> GPA double + Id : int + set absent> Marks : List + Name : string Methods + AddMark(courseName: string, numberOfCredits: int, grade: int) calculateGpa) : void + constructor Student() + constructor Student (id: int, name: string) Create the following class members: [1] gpa is a private field containing the GPA of a student. [1] GPA is read only property providing the access to the gpa field. [1] Id is auto implemented property representing student id. [1] Name is auto implemented property representing student name. [1] Marks is auto implemented read only property that contains a list of Mark objects. [1] A public parameterless constructor that initialize Marks property. [1] A constructor that takes 2 parameters: student id and the name and assigns their values to appropriates properties. [1] Make sure that there is no code duplication in the constructors. [2] calculateGpa method calculates the student's GPA based on the current marks and assign it to the appropriate class member. GPA is calculated as the sum of weighted grades divided by sum of credits. The weighted grade is calculated by multiplying a course grade by number of the course credits. [2] AddMark method has 3 parameters: course name, number of credits and grade. The method will create the Mark object, assigns the grade to the appropriate property, adds it to the list of marks for a student. Mark object is only added to the list of marks if the grade is assigned, i.e. there is no exception caused by grade outside of range. [1] This method (AddMark) makes the necessary updates to other members of the student object, like recalculating the GPA

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!