Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

make a class library with two classes in it: Student and Mark. The class diagrams are shown below. Make sure that your classes conform to

make a class library with two classes in it: Student and Mark.

The class diagrams are shown below. Make sure that your classes conform to them exactly.

Create Mark class.

make the following class members:

  • grade is a private field representing the grade for a course
  • NumberOfCredits is the public read only field representing weight of the course in credits
  • CourseName is auto implemented property representing the course name
  • Grade is the property that is accessor for grade field. The valid grade is in range 0 to 100. The property will throw an exception in case of invalid value with the message: "Mark with value {value} is not valid" {value} is the value of the invalid grade.
  • A constructor with two parameters: course name and number of credits for the course. It assigns them to appropriate members.
  • ToString() method that generates the string with information about the mark. Make sure that your output matches the one that is provided.

make Student class

make the following class members:

  • Gpa is a private field containing the GPA of a student.
  • GPA is read only property providing the access to the gpa field.
  • Id is auto implemented property representing student id.
  • Name is auto implemented property representing student name.
  • Marks is auto implemented read only property that contains a list of Mark objects.
  • A public parameterless constructor that initialise Marks property.
  • A constructor that takes 2 parameters: student id and the name and assigns their values to appropriates properties.
  • Make sure that there is no code duplication in the constructors.
  • calculateGpa method t 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.
  • 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.
  • This method makes the necessary updates to other members of the student object.

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

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students also viewed these Databases questions

Question

How does a freemium business model work?

Answered: 1 week ago

Question

3. Would you say that effective teamwork saved their lives?

Answered: 1 week ago