Hello ๐, here's my submission for Hashnode Hackathon Powered by Vercel. It's a **Grade Point Average (GPA)** and **Cumulative Grade Point Average (CGPA)** calculator with a special feature which is to forecast the average score a student needs to end up with a 1st Class, 2nd Class Upper/ Lower per semester from his/her known scores.

## Inspiration for the project

During any exam period, I'll sit down, open up Excel sheet, inputs my current courses grades with their credit unit to formulating potential grades I could get to end up with a first-class (I like to aim high ๐) from my current grades. Then I thought of an idea, could I make a website that does this for me?

The idea faded away because I said to myself, it's too complicated for me to achieve even without trying.

On December 22nd, Hashnode Christmas Hackathon was announced but I couldn't come up with an idea for the hackathon then a week later, I got a message from a friend Rhoda asking for a suggestion on what to build for the hackathon.

After thinking for awhile my old idea came to mind and I pitched the idea to her then we started working on the project but eventually stopped since the deadline for the Hashnode Christmas Hackathon passed.

Thankfully, another hackathon was released and the motivation for the project was revived again, hooray! ๐๐

## Planning the project

Planning how the project should work and look was a lot of stress but I came up with a structure as a guide of how the end product should be, well at least something just to get started with.

There have been a lot of changes added to the final design from the sketches below.

Also, I came up with a guide for what features should be implemented:

While working on the project at the earlier stage, I did a lot of implementation of the features by myself even without telling my comrade - Rhoda, so a better teamwork practice was needed and we worked on that.

## Grade System of the project

This project makes use of my Universities grade system and also most schools grade system which is :

Score Range | Letter Grade | Grade Value |

70 - 100 | A | 5 |

60 - 69 | B | 4 |

50 - 59 | C | 3 |

45 - 49 | D | 2 |

40 - 49 | D | 1 |

< 40 | F | 0 |

Final - CGPA (FCGPA) | CLASS OF DEGREE. |

4.50 - 5.00 | 1st Class. |

3.50 - 4.49 | 2nd Class Upper |

2.50 - 3.49 | 2nd Class Lower |

1.50 - 2.49 | 3rd Class |

1.00 - 1.49 | Pass |

0.00 - 0.99 | Fail |

If a user tries using the application on any other grade system apart from this, I'm afraid it won't work as expected.

## Challenges encountered

**Implementing main feature**

After getting a basic ideal look and functionalities for the project the main feature (which is to get the average score a student needs to end up with a 1st Class, 2nd Class Upper/ Lower per semester from his/her known scores. ) was difficult to figure out and implement.

To demonstrate the challenge, here is a scenario for the calculation.

For example, you're on a **4 years** program at a University. That means you'll need 8 GPA scores in totally and you're only done with the first year so you have 2 GPA scores.

So, therefore, there're **6** unknown GPA scores left. Let's say the first 2 GPA scores gotten are **3.65** and **4.32**. Then you'll need **4.671666667** as an average to end up with a **4.50** (a first-class) at the end of the **4 years** program.

```
(3.65 + 4.32 + (4.671666667 * 6 )) / 8 = 4.5
```

From the calculation above, an algorithm needed to be created that when used on whatever current GPA's you have it'll still derive the average score.

This part was tricky, I couldn't figure it out on my own, so I asked one of my teachers who tutored me on Mathematics when I was to gain admission into the University. He came up with a Mathematical algorithm I can use to solve this problem.

All I had to do was to implement the mathematical algorithm into code, in order for the application to work. This was tough, but after searching Google and Stack Overflow for answers having in mind the idea I wanted to bring to code, I finally found answers.

Big thanks to Stack Overflow

**Average score display**

Another little challenge we had was with the average derived score. It could be in decimal places just like from the example above - **4.671666667** (9 decimal places). This was a problem because the decimal places could be up to 12 and so on. I had to figure out a way to make the average score into a 2 decimal place fraction.

Meanwhile, If I just picked only the first 2 decimal from the fraction (**4.671666667**) that will be **4.67** it wouldn't add up to **4.5** anymore.

```
(3.65 + 4.32 + (4.67 * 6 )) / 8 = 4.49875
```

Then I decided to calculate for

**4.52**for a 1st Class instead of**4.50****3.52**for a 2nd Class Upper instead of**3.50****2.52**for a 2nd Class Lower instead of**2.50**

Doing this allowed me to be able to round whatever decimal place the average score is to a 2 decimal place.

For example, into

4.60.

Also by increasing the scores to be calculated to **4.52**, **3.52**, **2.52** the average score isn't exactly going to round up to the scores respectively because they'll be rounded up to 2 decimal place but they will be in the range of **4.50** to **4.52** and so on for other scores at least not below **4.50** or **3.50** or **2.50**.

## Bonus Feature

After the entire functionalities were completed, I thought what else is missing. Then I came to the conclusion it's making the app a **Progressive Web Application (PWA)**

At the moment of the thought, I had no idea how I'll implement a PWA functionality. So I asked Rhoda if she knew how PWA works, thankfully she knew how it works.

Rhoda implemented the PWA functionality and I learnt from how she did it.

Also after some testing, we noticed the application might not be easy to utilize so Rhoda implemented a need help modal, which displays to the users how the app should be used.

## Conclusion

I had a fun experience making the app work and also working with someone. All I hope for is that students would find the app useful as I would.

Thanks to Rhoda, Mr Victor (my maths instructor) and Stackoverflow for helping to make this project a success. Hopefully, I'll improve on the project later on, by making it a mobile application.

P.S This project also belongs to Rhoda because she did put in a lot of effort making the project.

Thanks to Hashnode for making me fulfil this project ๐.