03-17-2009
Grade Score Script Project
What I thought would be an extremely simple project has proven more difficult for me than I thought. Here are the parameters:
Quote:
Write a script to calculate the total score and assign a letter grade for each student
(source data is in the file “grades”). Output the all students' name, scores, and grades
in descending order of the total score. Note: please save the output to the file
“finalgrades.txt”.
Format of source data file (grades.txt):
Name Exam1 Exam2 Exam3
Content of source data file (grades.txt):
Tom 23 12 15
Jack 30 15 29
Jane 31 25 19
The final letter grade will be determined based on the following criteria:
A 90 and above
B 80 thru 89
C 65 thru 79
D 50 thru 64
F less than 50
Output (finalgrades.txt)
Name Exam1 Exam2 Exam3 Total Grade
Jane 31 25 29 85 B
Jack 30 15 29 74 C
Tom 23 12 15 60 D
Thus far, I've been able to sort the final grades, but I'm having a lot of trouble with appending the correlating letter grade to the end of each line. Any help would be greatly appreciated. Thanks!
7 More Discussions You Might Find Interesting
1. Solaris
We have a system running ssh. When a user logs in, they do not get the project they are assigned to (they run under "system"). I verify the project using the command "ps -e -o user,pid,ppid,args,project". If you do a "su - username", the user does get the project they are assigned to (and all... (2 Replies)
Discussion started by: kurgan
2 Replies
2. Post Here to Contact Site Administrators and Moderators
Hello
The same thing happen to me yesterday I can´t record my score on invaders game. (0 Replies)
Discussion started by: lo-lp-kl
0 Replies
3. Shell Programming and Scripting
Hi guys,
Please guide for Solution.
PART-I
INPUT FILE (has 2 columns ID and score)
TC5584_1 93.9
DV161411_2 79.5
BP132435_5 46.8
EB682112_1 34.7
BP132435_4 29.5
TC13860_2 10.1
OUTPUT FILE (It shudn't contain the line ' BP132435_4 29.5 ' as BP132435 is repeated... (2 Replies)
Discussion started by: smriti_shridhar
2 Replies
4. News, Links, Events and Announcements
A new project was posted on your project board.
Project title: Bash Shell Tutoring
Estimated Budget:
$50/hr
Start date:
Immediately
Required skills:
Linux, Bash, Shell, UNIX
I work as a datawarehouse designer and developer.
Although I usually stick to the role of an analyst,... (0 Replies)
Discussion started by: Neo
0 Replies
5. Shell Programming and Scripting
Dear All,
I have the following file tabulated:
ID distanceTSS score
8434 571269 10
10122 393912 9
7652 6 10
4863 1451 9
8419 39 2
9363 564 21
9333 7714 22
9638 8334 9
1638 1231 11
10701 918 1000
6587 32056 111
What I would like to do is the following, create 100 new files based... (5 Replies)
Discussion started by: paolo.kunder
5 Replies
6. Shell Programming and Scripting
awk '{if(len==0){last=$4;total=$6;len=1;getline}if($4!=last){printf("%s\t%f\n", last, total/len);last=$4;total=$6;len=1}else{total+=$6;len+=1}}END{printf("%s\t%f\n", last, total/len)}' exon.txt > output.txt
In the attached file I am just trying to group all the same names in column $4 and then... (2 Replies)
Discussion started by: cmccabe
2 Replies
7. UNIX for Dummies Questions & Answers
Hi,
I would like to know how can I get a mean score value by ID over a defined genomic region. Here it is an example:
file1
12 100 103 id1
12 110 112 id1
12 200 203 id2
file2
12 100 101 1
12 101 102 0.8
12 102 103 0.7
12 110 111 2.5
12 111 112 2.8
12 200 201 10.1
12 201 202... (7 Replies)
Discussion started by: fadista
7 Replies