pyhthon

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. 👍
  2. 👎
  3. 👁
  1. Computer/web programming help needed here.

    1. 👍
    2. 👎

Respond to this Question

First Name

Your Response

Similar Questions

  1. Algebra 1

    Please, I am very confused in the Systems of Equations and Inequalities Unit Test that is only 27 questions. The test starts with: 1.Which graph represents the solution to the given system? y = –x + 2 and y = 3x – 1 I am in

  2. MATHS GRade 10

    MAtHS gRade 10 AssIgnmENT MEMo TerM 2 /2021

  3. geography

    Which statements describe the management of the earth's resources? 1)Resource management becomes more important as the population increases 2)Resource management is a global issue. 3)Resource management is a local issue.

  4. billing/coding

    which of the following statements about risk management is true? a)risk management is concerned with reducing exposure to legal liability b) risk management is a spontaneous response to an unexpected incident C) risk management is

  1. Geography

    Which statements describe the management of the earth's resources? Resource management becomes more important as the population increases. Resource management is a global issue. Resource management is a local issue. Resource

  2. allied health part 2-21

    which of the following statements about risk management is true? a. risk management is unique to the health care industry b. risk management is controlled and managed by hipaa regulations. c. risk management is concerned with

  3. programming

    create the logic for a program that calculates and displays the amount of money you would have if you invested $5000 at 2 percent simple interest for one year. create a separate method to do the calculation and return the result

  4. CRIMINAL JUSTICE

    Discuss the three types of management styles that are reviewed in your course materials (Scientific Management, Human Relations Management, and Systems Management). * Which style do you believe would be the most effective to use

  1. MATHS GRade 10

    Grade 1O AssIgnmENT TerM 2

  2. english

    - Computers - English - Foreign Languages - Health - Home Economics - Math - Music - Physical Education - Science - Social Studies GRADE LEVELS - Preschool - Kindergarten - Elementary School - 1st Grade - 2nd Grade - 3rd Grade -

  3. management information system

    hi theres a bunch of wrong answers in my quiz earlier and i want to know the correct answer, so please help, and this not not my homework..thanks 1.amount of time and attention required is a typical___measure of product

  4. Management

    o Differentiate between management and leadership. o Describe the roles and responsibilities that organizational managers and leaders play in creating and maintaining a healthy organizational culture. o Evaluate the affect of

You can view more similar questions or ask a new question.