VB icon

Subject Grade Solver in JavaScript

Email
Submitted on: 11/16/2015 12:52:04 PM
By: Jake R. Pomperada  
Level: Beginner
User Rating: Unrated
Compatibility: JavaScript
Views: 833
author picture
 
     A program that I wrote that will compute the prelim, midterm and endterm grade in a particular subject using JavaScript this program also give a remarks whether the subject is PASSED or FAILED. If you have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com. My mobile number here in the Philippines is 09173084360.

 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
'**************************************
' Name: Subject Grade Solver in JavaScript
' Description:A program that I wrote that will compute the prelim, midterm and endterm grade in a particular subject using JavaScript this program also give a remarks whether the subject is PASSED or FAILED.
If you have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com. 
My mobile number here in the Philippines is 09173084360.
' By: Jake R. Pomperada
'**************************************

<html>
<style>
body,p {
 font-family:arial;
 font-size:16px;
 font-weight:bolder;
 }
 
.container {
width: 350px;
clear: both;
}
.container input {
width: 100%;
clear: both;
}
</style>
	<div class="container">
<body>
<h3> Subject Grade Solver </h3>
<br/>Subject
<input type="text" id="subject" name="subject">
<br>
<br/> Prelim Grade
<input type="text" id="prelim" name="prelim">
<br>
<br/> Midterm Grade
<input type="text" id="midterm" name="midterm">
<br>
<br>Endterm Grade
<input type="text" id="endterm" name="endterm">
<br>
<br>
<button onclick="compute_grade()">Compute Grade</button>
<br><br>
<p id="demo"></p>
<p id="demo2"></p>
<p id="demo3"></p>
</div>
<script>
 function compute_grade() {
var subject = document.getElementById("subject").value;
	var prelim = document.getElementById("prelim").value;
	var midterm = document.getElementById("midterm").value;
	var endterm = document.getElementById("endterm").value;
	
 solve_prelim = parseFloat(prelim) * 0.20;
	 solve_midterm = parseFloat(midterm) * 0.30;
	 solve_endterm = parseFloat(endterm) * 0.50;
	
 final_grade = (solve_prelim + solve_midterm + solve_endterm);
	 
	 if (final_grade >= 75) {
	 remarks = "PASSED";
	 results = "In your subject " +subject +"."
 results2= " Your final grade is " + final_grade.toFixed(0) + ".";
		 results3 = " You " + remarks + " the subject."; 
				 
		 }
		 else {
		 remarks="FAILED";
		 results = "In your subject " +subject + ".";
		 results2= " Your final grade is " + final_grade.toFixed(0) + ".";
		 results3="You " + remarks + " the subject."; 
				 
		 } 
 document.getElementById("demo").innerHTML = results;
	 document.getElementById("demo2").innerHTML = results2;
	 document.getElementById("demo3").innerHTML = results3;
 }
</script>
</body>
</html>


Other 108 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.