Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Can U Write code to solve this problem plss help me (http://www.go4expert.com/forums/write-code-solve-plss-help-t17949/)

sujan.dasmahapatra 11Jun2009 23:51

Can U Write code to solve this problem plss help me
 
Write an ANSI C program that calculates the letter grade of students in a class. The input is a file consists of student’s records, every record in a line and terminated by a newline character.
Each line consists of
• Student ID, a string of 8 digits
• Student name in the form “lastname, firstname:” where the last name and the first name are separated by a comma and a single space (no middle initials).
• Final exam mark: an integer out of 100
• Midterm mark: an integer out of 50
• The mark for three quizzes (each out of 10): each is an integer
The course mark is 50% final, 30% midterm and 20% quizzes
For the quizzes, if a student missed a quiz with a legitimate excuse, he gets “-“ (the minus sign) and the weight of this quiz is divided among the 2 other quizzes, a maximum of 1 missed quiz.
The separation between the colon after the first name and the scores, as well as between the scores is one or more spaces.
The maximum length of any line is 100 characters
Your program should read and process each line until it encounters the end of the file.
Score
Letter grade
>=90
A
>= 80 && <90
B
>=70 && <80
C
<=60 && <70
D
<60
F
The output of the program should be



Student ID, name, and a letter grade according to the previous table, there is exactly one space between the ID and the name, and 2 spaces between the colon after the name and the letter grade. Also, each student should be on a separate line.
After that, a single line stating “N students processed” where N is the number of students.
Your program should be able to deal with the following cases:
• If the student ID is not 8 digits, the letter grade is calculated and displayed, however the ID is replaced by “XXXXXXXX”
• If any of the test or quizzes scores are missing, the ID, and name are displayed, following by “MISSING GRADE” instead of the letter grade.
• If any mark is greater than the maximum, or a negative number display
“ILLEGAL MARK”
• If the length of the record is more than 100, the ID is displayed followed by
“ILLEGAL RECORD”
Example of an input file
12345678 Doe John, 89 44 2 – 9
Look at the assignment policy for details about submitting and marking

xpi0t0s 12Jun2009 03:50

Re: Can U Write code to solve this problem plss help me
 
Sounds straightforward enough. What have you got so far and where are you stuck?

Yes, I could write the code to do it, but you would learn nothing that way.

SaswatPadhi 12Jun2009 06:46

Re: Can U Write code to solve this problem plss help me
 
Quote:

Originally Posted by sujan.dasmahapatra (Post 49410)
Look at the assignment policy for details about submitting and marking

Go4Expert is not a place for dumping your assignments and asking for their solution.

sujan.dasmahapatra 12Jun2009 11:55

Re: Can U Write code to solve this problem plss help me
 
Quote:

Originally Posted by xpi0t0s (Post 49412)
Sounds straightforward enough. What have you got so far and where are you stuck?

Yes, I could write the code to do it, but you would learn nothing that way.

Actually i dont understand how would I calculate the Grade......what i have undestood is that
0.5*89+0.3*44+?????
50% for 89 and 30% for midterm what for the 3 quizzes plss tell me how would i calculate the grade. refer the example data.

xpi0t0s 12Jun2009 19:49

Re: Can U Write code to solve this problem plss help me
 
OK well you have to add three parts together so let's start by taking the midterm mark.
This is marked out of 50 and accounts for up to 30% of the final score.
So if you score 50/50 in the midterm then that would give you the full 30%.
If you got 25/50 then that would give you half the 30% allocation which is 15%.

What would you have to score out of 50 to get a third of the 30% allocation, i.e. 10%?
Try with a few other numbers and that should give you some idea of how to work it out as a formula.

The quizzes work the same way. There are three quizzes, each out of 10. If you get 10/10 for all three, that gets you the full 20%. What would you get if you scored 5/10 for all three? As with the midterm, play with some numbers and see if you can derive a formula. Don't just guess at a formula; work it out.

Here's some example data for you. Let's say you get 50/100 for the final, 25/50 for the midterm and 5/10 for all three quizzes. What would the overall grade be?


All times are GMT +5.5. The time now is 12:48.