Question: Part One Write a C# code for the following UML classes: Course - code : String - title : String - credit : int -

Part One

Write a C# code for the following UML classes:

Course

- code : String

- title : String

- credit : int

- prerequisite_code : Sting

+ Course (code, title, credit, prereq)

+ checkPrereq ( ) : Boolean

+ ToString ( ): string

Notes:

The first methods is a constructor.

checkPrereq ( ) should compare the level of the course and its prerequisite. It returns true if the level of the prerequisite below the level of the course, or return false otherwise.

ToString override the inherited method to display the fields of the objects (code, title, credit and prerequisite_code) in well formatted way.

(10 Marks)

Student

- id : string

- name : string

+ schedule[ ] : Course

+ Student (id)

+ Student (id, name)

+ setName (name: string)

+ getName ( ) : string

+ ToString ( ): string

Notes:

The first 2 methods are constructors.

Set and get are well known methods.

ToString override the inherited method to display the fields of the objects (id, name and its schedule elements) in well formatted way.

Part Two

Using the classes above, write the statement(s) needed for the following questions (use fictional data):

Create two objects named (maleStudent) and (femaleStudent) using the two different constructors with any values you select.

Set any name for the object created by the first constructor.

Display the names of both objects.

Create 3 different courses for each student and load them in its schedule array.

Demonstrate the work of checkPrereq () method for a couple of courses showing one of them returning true and the other returning false.

Display all the information (fields) of both students including their schedule courses details..

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!