Vous êtes sur la page 1sur 2

Assignment 2

CSD 2354: Introduction to C#.net


Date of Submission: 8th Feb
In this assignment, you will output a report card. Initially, you will take as input the number of students;
after that, for each student, you will take student name (fixed format: First_name<space>Last_name)
and numerical grade (between 0 and 100) as input and you will construct student objects.
For name and numerical grade, the student class will provide get and set methods.
String getName()
setName(string s)
double getNumericalGrade()
setNumericalGrade(double n)
There will also be the following two methods:
char getLetterGrade(): This will use the numerical grade and convert it into a letter grade. The
conversion logic will be as follows:
(score >= 90 && score <= 100) gets an A
(score >= 80 && score < 90) gets a B
(score >= 60 && score < 80) gets a C
(score >= 50 && score <60)gets a D
(score<50) gets an F
String getDisplayText(): This method will process student name and use the letter grade to construct
the following text:
LastName, FirstName received the grade grade [Eg., Doe, John received the grade A]
After constructing the student object you will store them in an array and sort them in descending order
of their numerical grade. After sorting, you will iteratively go through that array and print the output of
getDisplayText() for each objects.

Sample input:
3
Joe Black 81.5
David Fisher 91
Matthew Perry 83
Sample output:
Fisher, David received the grade A
Perry, Matthew received the grade B
Black, Joe received the grade B

Vous aimerez peut-être aussi