0% found this document useful (0 votes)
11 views2 pages

HW#2 (Classes)

The document discusses an assignment for an intermediate programming class. It provides details on creating a Student class with various properties and methods, and instructions for using the class in a console application to demonstrate different capabilities.

Uploaded by

qpelinsubc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views2 pages

HW#2 (Classes)

The document discusses an assignment for an intermediate programming class. It provides details on creating a Student class with various properties and methods, and instructions for using the class in a console application to demonstrate different capabilities.

Uploaded by

qpelinsubc
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

MISY 2313: Intermediate Programming for the MIS

Homework 2 – 12% of the total mark


Dr. Sameer Al-Imamy – Fall 2022-2023
Due on 11th of December 2023
Present it as console program (in zip file)
Developed individually
Classes & Objects

a) Write a C# code for the following UML class:


(7 marks)

Student
Notes:
- id : String
- name : String - The first 2 methods are constructors.
- GPA : double - Set and get are well known methods.
+ Student (id) - isHigher (av: double) should compare the student
+ Student (id, name) GPA with an average, say 2.7 passed as a
+ setName (name: String) parameter. The method returns true if the student
+ setGPA (value: double) GPA is higher than the average, and false
+ getGPA( ): double otherwise.
+ getName ( ) : String - ToString override the inherited method to display
+ isHigher (av: double) : Boolean the fields of the objects (id, name and GPA) in
+ ToString ( ): String well formatted way.
-
b) Write the statement(s) needed for the following questions:
(total 5 marks)
a) Create two objects named (maleStudent) and (femaleStudent) using different constructors
with ant values you select.
(1 marks)

b) Set any name for the object created by the first constructor.
(0.5
mark)

c) Set the GPA of both objects for any values.


(0.5 mark)

d) Call isHigher method and print appropriate message.


(1
marks)

e) Display the GPA of the femaleStudent.


(0.5 marks)

f) Display the name of the maleStudent.


(0.5 mark)

g) Display the information (fields) of one of the objects explicitly and the other object
implicitly.
(1 marks)

You might also like