Click here to Skip to main content
15,881,455 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Introduction:
Write a C# program which allows the user to enter student information and outputs the appropriate grade for the student. This assignment involves the use of classes, arrays or collections, loops and methods.
Result Class:
Create a class called Result.cs which serves as the main class. This class will first prompt the user for number of student records. You will create an array based on this information. The program reads a list of student names, marks and grades into an array. This is done using a loop and prompting the user to enter the names and marks, one by one. (The student name should not be duplicate).The grade is automatically computed based on the mark provided. The Result class shall include the following options:
1. Display a Student Mark
2. Change Student Mark
3. Print out information for all students
4. Exit program

Student Class:
Create a class called Student.cs. This class contains the following:
a) class data fields name, mark and grade
b) public Student (string name, double mark, string grade)
// constructor

c) public string getName() / / to return name of student
d) public double getMark() // to return mark of student
e) public string getGrade() // to return student grade
f) public void setMark(double mark) // to set student mark
g) public string setGrade(double mark) // mark is first checked using a nested if-else and switch to determine grade.
The possible grades are:
0 <= mark < 50 -
50 <= mark < 60 -
60 <= mark < 70 -
70 <= mark < 80 -
80 <= mark < 100 -
Sample Output:
Please enter number of student marks you would like to add: 2
Please enter name of student 1 : Sam
Please enter mark for student 1 : 33
Please enter name of student 2 : John
Please enter mark for student 2 : 88
Choose an option:
1. Display a Student Mark
2. Change Student Mark
3. Print out information for all students
4. Exit program
Enter Option: 1
Display a student mark
Please enter name of student you would display mark for: jjj
I am sorry. Student: 'jjj' does not exist
Choose an option:
1. Display a Student Mark
2. Change Student Mark
3. Print out information for all students
4. Exit program
Enter Option: 1
Display a student mark
Please enter name of student you would display mark for: Sam
Marks for Sam is: 33.0
Choose an option:
1. Display a Student Mark
2. Change Student Mark
3. Print out information for all students
4. Exit program
Enter Option: 2
Change Student Mark
Please enter name of student you would like to change mark for: John
Current marks for John is: 88.0
Enter new mark for John: 3333
Invalid Entry! Marks must be between 0 - 100!
Enter new mark for John: 70
New grade for John is: D
Choose an option:
1. Display a Student Mark
2. Change Student Mark
3. Print out information for all students
4. Exit program
Enter Option: 3
Print out information for all students
Name Mark Grade
Sam 33.0 F
John 70.0 D
Choose an option:
1. Display a Student Mark
2. Change Student Mark
3. Print out information for all students
4. Exit program
Enter Option: 4
Thank you for using the system. Good bye!


I was unable to solve it so kindly provide me with solution.
Posted
Updated 8-Jul-11 1:16am
v4
Comments
Tarun.K.S 8-Jul-11 7:09am    
Nimit, tell us where are you stuck? And no one is going to solve this for you.
OriginalGriff 8-Jul-11 7:20am    
Reason for my vote of one: posts the whole of the homework question, and expects us to do it for him...

It doesn't work that way here. This is clearly a homework assignment and we are not here to do your homework for you. What you need to do is demonstrate some level of effort. When you run into code issues you can express those concerns here and we will gladly volunteer our time to help you out. As it stands you need to do the work first.
 
Share this answer
 
If you are going to post your homework, at least try to make it look like you have attempted to do something yourself!

We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, or learn the Magic Words: "Do you want fries with that?"
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900