Thursday, April 28, 2022

Average Grade Using ng-bind in AngularJS

 Machine Problem

Write a program that uses the ng-bind directive that will accept five grades, and then the program will compute the average grade and display the remarks on whether the student passed or failed in the subject using AngularJS.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.


My mobile number here in the Philippines is 09173084360.


Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg


=================================================


Want to support my channel?

GCash Account

Jake Pomperada

09173084360


Paypal

https://paypal.me/jakerpomperada


Patreon

https://www.patreon.com/jakerpomperada


Thank you very much for your support






Program Listing

index.htm

<!-- index.htm
  Author   : Prof. Jake Rodriguez Pomperada, MAED-IT, MIT
  Date     : July 29, 2021 Thursday  5:56 PM
  Place    : Bacolod City, Negros Occidental
  Websites : www.jakerpomperada.com and www.jakerpomperada.blogspot.com
  Email    : jakerpomperada@gmail.com
 -->
<html>
<head>
  <title>Addition of Three Numbers Using ng-bind in AngularJS</title>
</head>
<style>
body {
  font-family: arial;
  font-size: 25px;
  font-weight: bold;
}
</style>
<script type="text/javascript" src="angular.min.js">
</script>

<script>
       var app = angular.module("average_grade", []);
        app.controller('app', ['$scope', function ($app) {
         $app.solve_grade= function () {
                $app.average = 0;
                $app.average = ($app.grade_1 + $app.grade_2 + $app.grade_3 + $app.grade_4 + $app.grade_5) / 5 ;
                
                $app.final_grade = $app.average.toFixed(0);

                if ($app.final_grade >= 75) {
                  $app.remarks = "Passed";
                } else {
                  $app.remarks = "Failed";
                }

                $app.result = "The Average Grade is " + $app.final_grade + ". You "
                              + $app.remarks + " the Subject.";
            }
        }]);
    </script> 
</script>  
<div ng-app="average_grade" ng-controller="app">
  <form>
  <table border="0" cellspacing=10>
  <tr>Average Grade Using ng-bind in AngularJS</tr>
  <tr>
  <td>Enter Grade Number 1 </td>
  <td><input type="number"  ng-model="grade_1" ng-change="solve_grade()"></td>
  </tr>
   <tr>
  <td>Enter Grade Number 2 </td>
  <td><input type="number"  ng-model="grade_2" ng-change="solve_grade()"></td>
  </tr>
   <tr>
  <td>Enter Grade Number 3 </td>
  <td><input type="number"  ng-model="grade_3" ng-change="solve_grade()"></td>
  </tr>
   <tr>
  <td>Enter Grade Number 4 </td>
  <td><input type="number"  ng-model="grade_4" ng-change="solve_grade()"></td>
  </tr>
   <tr>
  <td>Enter Grade Number 5 </td>
  <td><input type="number"  ng-model="grade_5" ng-change="solve_grade()"></td>
  </tr>
</table>
  </form>
    <span ng-bind="result"></span>
   </p> 
</div>
</body>
</html>


No comments:

Post a Comment