Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- function calcMinExam() {
- var first = document.minExam.first.value;
- var second = document.minExam.second.value;
- var ne = /^[0-9]+$/;
- if(first.match(ne) && second.match(ne)) {
- var minA = (8950/15) - (43/15)*first - (42/15)*second;
- var minB = (7950/15) - (43/15)*first - (42/15)*second;
- var minC = (7450/15) - (43/15)*first - (42/15)*second;
- var minD = (6950/15) - (43/15)*first - (42/15)*second;
- document.write("<h3> Results: </h3>");
- document.write(minA+" to get an A<br />"+minB+" to get a B<br />"+minC+" to get a C<br />"+
- minD+" to pass");
- document.write("<p><a href=\"javascript:location.reload(true)\">Back</a></p>");
- } else {
- alert("Error: You must enter valid number grades.");
- }
- }
- function calcFinalAvg() {
- var first = document.finalAvg.first.value;
- var second = document.finalAvg.second.value;
- var exam = document.finalAvg.exam.value;
- var ne = /^[0-9]+$/;
- if(first.match(ne) && second.match(ne) && exam.match(ne)) {
- var semAvg = Math.round(.43*first + .42*second + .15*exam);
- document.write("<h3> Results: </h3>");
- document.write("Semester Average: "+semAvg);
- document.write("<p><a href=\"javascript:location.reload(true)\">Back</a></p>");
- } else {
- alert("Error: You must enter valid number grades.");
- }
- }
- </script>
Add Comment
Please, Sign In to add comment