hello all

can anybody help me with this tutorial question please???

This is only part one and i think i can manage the rest of it if uoy help me with that part. I know that you don't help students with their homworks or assignments but I have completly no idea about how to start it.

Please help me if you find it easy to do :sad:


This is the question

write a program that will analyse student results for five subject studied on a particular course. The results for all students are stored in a file. The file has the following format:-

Course_Name max. 60 chars.
Subject_name1 max. 30 chars
Subject_name2 max. 30 chars
Subject_name3 max. 30 chars
Subject_name4 max. 30 chars
Subject_name5 max. 30 chars
Student_Name1 max. 25 chars
mark1 mark2 mark3 mark4 mark5
Student_Name2
mark1 mark2 mark3 mark4 mark5
etc.


The first line of the file is the name of the course, the next five lines are the names of the subjects studied the remainder of the file is the student results. Each students results consists of 2 lines, the first line is the student name (family name followed by given name max. 25 characters), the next line is a list of the exam marks for this student separated by spaces and ending with a newline character( i.e. the enter key).

Write a program to read the data file and produce the following :

1)
A file containing the name, average mark and degree classification for each student. You should call this file XXFILEA.TXT where XX are your initials and it should be written to the A: drive. (use your homedrive for testing purposes)
Typical example of my file AGFILEA.TXT might be :-

Name Average Mark Classification
Brown John 62 2:1
Hawking Stephen 95 1st
Kroto Harry 69 2:1
Lumley Joanna 55 2:2
Student Lazy 33 Fail

The names should be formatted to be lowercase and start with a capital letter. The degree classifications can be taken as >=70 1st , 60 -69 2:1, 50 - 59 2:2, 40 - 49 3rd, 35 - 40 pass, <35 fail.

*Suggestion: Start by creating a text file with about five or six names with some marks. Next read in the file and simply print it on the display. Next try reading in the file and processing the data to calculate the aggregate marks printing the name and aggregate mark on the display. Now write it to a text file instead of (or as well as to) the display, and so on, i.e implement & test in stages.


An example file with only 2 students data:

BEng Electronics and Computer Engineering
Mathematics
Microprocessor Engineering
Digital Electronics
Analogue Electronics
Engineering Principles
Dent Arthur
67 55 76 51 42
Ryan Jeri
56 46 75 39 45


Thanks for your help again
And please help the new programmers who doesn't know a lot about programming :sad: :sad: :sad: :sad:

Post your initial attempt, we have to start somewhere.

will the txt file be static or do you need to account for changes in it during runtime? in other words do you need to addnew students to the program during run time. because its a class assignment, how touchy is your teacher when it comes to stuff like knowing file size and structure without testing the data through the program? do you know how many max students you will need to have? the way it is i would think that you would only need 2 fields in each stuct name and marks both arrays.

I would start with opening the file then storing the file in a struct. use the original student names to id the different structs start places.

Subject_name1 max. 30 chars
Subject_name2 max. 30 chars
Subject_name3 max. 30 chars
Subject_name4 max. 30 chars
Subject_name5 max. 30 chars

then when you see subject_name again you know thats the id of the start of a new struct. use the newline \n to end the processing of the array you know the size of all the arrays you will need.

do you need to use multiple compilation units or functions?

please correct me if im wrong in any of my logic...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.