In this assignment, you will create a simple grade management system. Think of this as an assignment-sized version of WebCT's "Your Grades" feature.

Again, you can have a look at a working grade manager to see how things should work. You can use XHTML code from this if you want.

There are three different programs that you have to write. They each accomplish different aspects of the grade management:

* View all grades: If the user types the correct administrator's password, the program should display a list of all of the students in the system along with their grades and comments.

* View a student's grade: Used to view the grades for a single student. If the given userid isn't in the system, you should display a message saying so.

* Set a student's grade: If the correct administrator's password is given, the student's information should be added.

A few other notes about the programs:

* You don't have to worry about catching errors in the user's input.

* All of your XHTML (including generated XHTML) and CSS must be valid.

* Keep good coding style in mind when creating your programs for this assignment.

* You should make sure that any comments with HTML tags or entities are displayed as code, not interpreted by the browser. The "Displaying HTML Source" example in the Guide handles this—you can handle the comments the same way here.

You can also use the cgi.escape function (from the cgi module) for this. So, to print all of the comments in the file, you might do this:

for entry in data:
print cgi.escape(entry[2])

Storing the List

The programs will have to store all of the grade data in a variable. The entry for a single student will be a list like this:

[ "userid", 10, "Comments" ]

The first entry in the list is the student's userid, the second is their mark (an integer) and the last is a string containing comments.

The entire grade list will be a list of these. So, it's a list of lists and you'll have to work with this data structure. For example, this loop will output the userids of all the students in the grade list grades:

for entry in data:
print entry[0]

Reading and Writing a Data File

You will have to store the data in a file, so it is accessible to the different programs that need it. You don't have to do this yourself; the provided gradelist module does this for you. You should download the source for the module and put it in the same directory as your programs. The module defines these functions:

* gradelist.write(data): Write the data from the grade list data to a file names grades.data in the current directory.

* data = gradelist.read(): Read the data from grades.data and return the grade list.

Once the module file is in your directory, you can use this module the same way as a built-in module: import gradelist .

Note that the argument to the gradelist.write function is the whole data object. So, the way you would use it (if you're modifying the file in some way) is like this:

import gradelist
data = gradelist.read()
... # do something to modify data
gradelist.write(data)

You can also start with a sample data file. This will let you work on the programs that use the data before you complete the program that sets user's grades.

You can experiment with the library and data structure in the Python interpreter:

>>> import gradelist
>>> data = gradelist.read()
>>> print data[0]
['somebody', 75, 'No answer for question 3']
>>> print data[1]
['astudent', 100, 'Very well done.']
>>> for entry in data:
... print entry[0]
...
somebody
astudent

Suggested Plan of Attack

1. Create the initial XHTML page with the forms.

2. Write a program that uses the gradelist module to load the data. Print out all of the userids. This doesn't have to be a web script (yet). Use the sample data file for testing.

3. Modify the program so that it outputs XHTML code and can be used as a web script. Add checking for the administrator's password and an error if it's incorrect.

4. Add printing of the user's mark and comments to this script.

5. Make a copy of the "view all" script and modify it so it only outputs one user's mark. Remove the password checking.

6. Write a program that reads the new grade from the form and outputs it to the XHTML page (so you can confirm that it's there).

7. Modify the program so it appends the new data to the end of the list (even if the user is already in the system).

8. Go back to the two programs that output data and make sure they convert <,> and & to entities. Test this by entering a comment like "Used the <h1> & <h2> tags." The rest of the page shouldn't turn into a heading when this is displayed.

9. Check the XHTML produced by all of the pages to make sure it's valid.

anyone know how this works??? its confusin

1 answer

Computer/web programming help needed here.
Similar Questions
    1. answers icon 3 answers
  1. Group assignment- Risk management planAssignment Instructions The following assignment is based on unit 2 of your module. You
    1. answers icon 1 answer
  2. Assignment DetailMGT240-1003A-01 Business Management and Leadership Assignment Name: Unit 3 Individual Project Deliverable
    1. answers icon 1 answer
    1. answers icon 0 answers
more similar questions