com131+assignment+4

2
Computer Science Department COMP131 ( Fall 2015/2016) Assign # 4 Due Date: Wed (16/12/2015) and Thur(17/12/2014)(in lecture) Notes: 1. The assignment should be submitted on the due date to your lecture instructor in class. ( Late Assignments will NOT be accepted for any reason) 2. The assignments are individual effort and copying the assignment will be treated as a cheating attempt, which may lead to FAILING the course. 3. You need to turn in a hardcopy of: a. Your complete code (printout of your html and JavaScript file(s) ). b. Screen shot of one run of your program (html page). Solve the Following question: Design a webpage (using html and JavaScript) similar to the one shown below that allows the user to enter a student's name and class marks and then calculates and prints the initial and final mark for the student. The percentages of the grades are as shown (mid Term Exam = 35%, Assignments = 10%, quizzes = 15%, and final exam = 40%). All grades are entered between 0 and 100 (you may assume that the user always enters the grade in the correct format). The initial mark calculated must be rounded to the closest integer value (you may use the Math.round function). Your code should include at least the following two functions: 1

Upload: ranin-jojas

Post on 28-Jan-2016

215 views

Category:

Documents


1 download

DESCRIPTION

computer science

TRANSCRIPT

Page 1: Com131+Assignment+4

Computer Science Department

COMP131 ( Fall 2015/2016)

Assign # 4 Due Date: Wed (16/12/2015) and Thur(17/12/2014)(in lecture)

Notes:

1. The assignment should be submitted on the due date to your lecture instructor in class. ( Late Assignments will NOT be accepted for any reason)

2. The assignments are individual effort and copying the assignment will be treated as a cheating attempt, which may lead to FAILING the course.

3. You need to turn in a hardcopy of:a. Your complete code (printout of your html and JavaScript file(s) ).b. Screen shot of one run of your program (html page).

Solve the Following question:

Design a webpage (using html and JavaScript) similar to the one shown below that allows the user to enter a student's name and class marks and then calculates and prints the initial and final mark for the student. The percentages of the grades are as shown (mid Term Exam = 35%, Assignments = 10%, quizzes = 15%, and final exam = 40%). All grades are entered between 0 and 100 (you may assume that the user always enters the grade in the correct format). The initial mark calculated must be rounded to the closest integer value (you may use the Math.round function).

Your code should include at least the following two functions:

1) findMark which takes four parameters (midterm mark, assignment mark, quizzes mark, and final mark) and returns the resulting student mark according to the percentages above.

2) findFinalMark which takes the rounded integer value of the mark as a parameter and returns the final mark of the student. The final mark is calculated as follows:

- If the sum of all the divisors of the mark (excluding itself) is equal to or higher than the mark then 10 points should be added to the mark to get the final mark. Otherwise, only 5 points are added.

You should make sure that any final marks that are greater than a 100 are printed as a 100.

Your page format should look very similar to the following:

1

Page 2: Com131+Assignment+4

2