Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

[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

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

Database Systems Design Implementation And Management

Authors: Peter Rob, Carlos Coronel

6th International Edition

061921323X, 978-0619213237

More Books

Students also viewed these Databases questions