Chi Square Tests Calculator

I have been given this stats calculator as a programming project unfortunately I have never done stats (incredible I know) so this has confused me somewhat. Heres the description:

**Description**

To produce a powerful and user-friendly data analysis package to help the user to conduct the following tests:

Input:

·Set of observed values

·Set of expected values (frequencies or proportions)

Output:

·Chi-square critical value

·Chi-square test statistic value

·Conclusion

Stuff i need help on: proportions, chi-square critical value and conclusion

1. Now firstly i'm not sure exactly how proportions are supposed to be implemented, if i could be shown one way to do it that would help me greatly.

2. chi-square critical value - I believe you need the degrees of freedom and probability to get the result from the table but this has got me quite confused on how to do it with the inputs given. Degrees of freedom seems to have 2 different ways of working out - which way do i need? and how do i know which probability to choose from the table.

3. Conclusion - Presumably this is the goodness of fit, how is this done and which ranges show significance and which ones don't?