Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,148,785 members, 7,802,459 topics. Date: Friday, 19 April 2024 at 02:45 PM

My Semester GPA Calculator With Javascript - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / My Semester GPA Calculator With Javascript (2202 Views)

Tutorial To Create A Mortgage Calculator With Javascript / Automatic Bitcoin Calculator With Bitcoin Market Price Tag For Sale / Javascript Source Code For GPA Calculator (2) (3) (4)

(1) (Reply) (Go Down)

My Semester GPA Calculator With Javascript by Wi5trone(m): 5:01pm On Feb 13, 2018
Hi, I am Wi5trone. A newly admitted medical student of UI. I am also a JavaScript lover(tho still learning). I did this simple GPA calc last night. It accepts all your details(name,department, courses, scores) and alerts you with your full details together with your GPA.
Check it out:

1 Share

Re: My Semester GPA Calculator With Javascript by Nobody: 9:49pm On Mar 07, 2018
Wi5trone:
Hi, I am Wi5trone. A newly admitted medical student of UI. I am also a JavaScript lover(tho still learning). I did this simple GPA calc last night. It accepts all your details(name,department, courses, scores) and alerts you with your full details together with your GPA.
Check it out:
Good innovation. �
Re: My Semester GPA Calculator With Javascript by concord129(m): 10:56pm On Mar 07, 2018
You be Baba. I'm also a javascript beginner but I must say, you really tried from my beginners perspective
Re: My Semester GPA Calculator With Javascript by joan1678(m): 2:30pm On Apr 16, 2018
Wi5trone:
Hi, I am Wi5trone. A newly admitted medical student of UI. I am also a JavaScript lover(tho still learning). I did this simple GPA calc last night. It accepts all your details(name,department, courses, scores) and alerts you with your full details together with your GPA.
Check it out:
Great one bro. Really nice wink don't let med school take this away from you o.
Re: My Semester GPA Calculator With Javascript by asalimpo(m): 10:59am On Feb 10, 2019
Wi5trone:
Hi, I am Wi5trone. A newly admitted medical student of UI. I am also a JavaScript lover(tho still learning). I did this simple GPA calc last night. It accepts all your details(name,department, courses, scores) and alerts you with your full details together with your GPA.
Check it out:
i downloaded ur app and looked at the source code. Your logic is correct but ur code needs fine tuning. Obviously, one can see that u r still new to this by glancing at your code. Areas tht need attention are: 1) code repetition. This is inefficient and a big no no in sofware engineering.
The code to determine d CLASS of grade was repeated tediously throughout the program for variables 'a','b' and 'c' through 'h'!
 
if (0<=a && a<39)
{var p1= 1}

You could have encapsulated the logic in an object and used it over and over without needing to repeat yourself.
DRY (Dont Repeat yourself) principle. Learn this principle.
2) some computations were redundant.
E.g first class is any gpa above 4.49 or above or equals to 4.5,so there's no need checking d upper bound, just check the lower bound.
I.e
 if(cgpa> 4.49) 
or
if(cgpa>= 4.5)

by not checking d upper bound,you save computation cycles. Same applies for checking upperbound of points in d A range. Ofcourse to avoid erroneous input,you would check that data entered is in the right range. Between 0 - 100.
3) Lastly,your way of checking comparisons,though correct nd logical would b unnatural to most ppl.
You can stick with it,if it's natural to you but typical norm is to place the literal on the right of d variable being compared.

if(0<=e)

Unnatural.
 if(e>=0) 
. Natural. I suggest u adopt the Natural form,it's easier to read.

1 Like

Re: My Semester GPA Calculator With Javascript by vezycash(m): 3:59pm On Feb 10, 2019
@asalimpo

Your DRY advice is highly useful. However, another tenet of programming is "Avoid premature optimizations."

Clock cycles, DRY, encapsulation... Are too many balls to pursue for a beginner.

I'll admit, this below looks great.

if(cgpa> 4.49)
or
if(cgpa>= 4.5)


He's already done one thing most programmers have problem with - shipping.

He's shipped i.e. Published his code for others to see.

My unsolicited advice to @Wi5trone kudos. Fretting about how your code looks right now is futile. No, it's guaranteed to make you quit.

So build more stuff. Target 5 more mini programs like this and publish them here.

After that come back to this one and see if you can improve it. You might have to rewrite it from scratch and that's fine.

Again kudos. If you ever need practical udemy videos. My number's in my signature.

2 Likes

Re: My Semester GPA Calculator With Javascript by DONADAMS(m): 12:38am On Feb 11, 2019
nice one....I also did something similar with python last year...it was cool though...

and by the way am I expected to give the total units or scores my self for the calculator to work? or do I need to fill all the boxes for the app to work cos I got an error when I tried using it...I tried just 4 courses tho...
Re: My Semester GPA Calculator With Javascript by wizgrade: 8:11pm On Feb 12, 2019
Nice one, however try and learn more on arrays. You can do wonders with arrays.

Also, do allow student to select number of courses they want to calculate. Thanks
Re: My Semester GPA Calculator With Javascript by oyolohi: 10:40pm On Feb 12, 2019
grin

1 Like

(1) (Reply)

Marek Cygan Wins Google Code Jam 2005 / Great Work guys / How Can I Send Bulk SMS To MTN Numbers With My Sender Id

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 20
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.