Statistical Analysis For student's coursework marks listed.

I have a fairly involved question about how to start

^^^ you forgot to type in your question. You just gave us a copy of the homework.

I would first create a class or struct to read the data into it.
Also you should think about a way to store all the data - probably want to use a vector or array.
not sure if he needs to store it, might be a one pass and discard problem. But first, yes, work on reading the file and maybe printing it to screen for practice. The examples should get you there quickly.

after you get the open/close / setup, it will look a lot like cin for this problem.
eg filevariablename >> variable

Last edited on
nice work.
before you try to do the next part, read all the parts. write down a list of what variables you might need.
for example:
part a needs % of students in each category. so you need a count of # of students as you read the file, as one item you see that you will want.
part c needs a count of students where (A column? not clear on what columns in file are) is <= 60.
and so on. You can extract all this stuff in a single read of the file, but you have to know what to put into the loop to get the information for each task.

eg
while( ... << variables)
{
numstudents++; //count how many so you can divide by it to get a %
if( one of the variable you read in <= 60)
{
numstudentsassessment++; //count how many were put in special session thing
//what else from the other tasks?
//something for part d here: the ones in assessment check to see if improved.
}
}

Last edited on
I managed to get some help from the internet, however, my compiler is giving an error message of "Error: Range-based loops are not allowed in C++98" and currently I am using Dev-C++ 5.11. Any idea to counter this issue?

I think a better question is "how will this code help you for this assignment?" Do you understand what the code does and how it works? If you're going to grab some code from the web, it's critical that you understand it. Otherwise it might hurt more than it helps.

I always find it helpful to read the assignment several times and think about the data that I'll need to write the program. In this case, there is one tiny but critical little bit in part D:
The comparison is conducted through three different analyses which are mean, median and standard deviation

To compute the median, you need to sort the values, which means you must store them all. So I think Learner2 is right: you should create a class to store the info for a single student and then make a vector of all of them.

After you have code to read the data, go through each part (a-g) separately and write the code to compute and print whatever is needed for that part. When you're done, go back through and format the code as needed.

Now speaking of output, you give this:
1
2
3
ID Total CW A B C
21716 36.33 87.34 46.68 7.34
21584 31.67 96.66 56.66 16.66

I see that the first column is the student ID and the second column is the total coursework mark, but what are columns A B and C? How are these values computed for these two students? Which of the parts (a-g) does this bit represent? Since it can't be the output for the all parts, where is the output for the others?

Basically, these questions all raise a red flag for me. What exactly is the required output? It will be impossible to write the program without knowing exactly what the output should be.


The posted output doesn't match the question at all.

And this part is senseless (since "the total final mark that they aim" is not specified ... is it assumed to be an "A"?):
After looking at the total coursework mark, students will start planning and estimating
their final exam mark so that they can achieve the total final mark that they aim. Generate
another text file named recommender.txt that will help the students to plan for their
final exam marks. The file will recommend the minimum mark that the students need to
score to achieve the targeted grade.

Someone handed you a complete program and now you're asking us to simplify it for you?
This is why it is so hard to get a job in CS — because there are so many cheating yahoos who can’t code themselves out of a paper bag without clogging up the résumé stack. No wonder people interviewing can’t believe a word that comes out of any applicant’s mouth.

Programming is friggin’ hard.

You can’t just cram last second and pretend your way through it like you did with math and language and gym class in high school.
You can’t just cram last second and pretend your way through it like you did with math and language and gym class in high school.
I suspect that we have a whole generation of people who truly believe that this is how you get things done: google the problem, cut & paste the answer.

They don't even think there's anything wrong with this. It's how they've gotten through years of school.
to be fair, an awful lot of basic work can be done that way. ^^^
Ive been doing a bit of that this last year, where I am having to juggle 4 new languages. Its amazing the number of simple, necessary, basic things that many languages cannot do (like, have an unsigned integer). Its amazing how quickly you can find a work-around online for the gaps :)

At some point, the approach gets you into trouble and if you lack anything else to fall back on, you can't do the work. But you can get a very long way before that hits with the current web.

This is also why I am often less than helpful. Ill tell them how to do it, but if they haven't been going to class and doing their work so far, it won't help them.
Last edited on
There is nothing wrong with looking up stuff online, and even learning stuff that way, even for professional purposes. I regularly look stuff up, if even just to make sure I remember how to do it correctly and don’t forget to handle any important gotchas. (Often enough I look up some small treatise I wrote myself on something I once did.)

But there is a world of difference between actually learning and understanding material and just getting your marks.

Makes me think of Tom Knight and the Lisp Machine http://catb.org/jargon/html/koans.html#id3141171
Last edited on
Tom Knight and the Lisp Machine

I was going to quote this here yesterday, I swear.
Last edited on
Topic archived. No new replies allowed.