Skip to content

About

2016 Android app: the minimum GPA you need next semester to hold a 9.0 CGPA, worked out amortized-analysis style

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

11 stars

Watchers

1 watching

Forks

Latest commit

ย 

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

CGPAAmortizedAnalysis โ€” know the GPA you need next semester to hit a 9.0

License: MIT Java Android Last commit GitHub stars PRs welcome

Enter your semester GPAs and credits. The app tells you the lowest GPA you can score next semester and still finish at a 9.0 CGPA, for every credit load from 16 to 27.

Features ยท Quick start ยท Architecture ยท Docs ยท Roadmap ยท Contributing

Note

Status: classic project. Built in May 2016 as a student project and restructured into MVC packages in June 2016. It is not actively maintained. The code targets Android SDK 23 and the 2016 support libraries. See Quick start for how to open it today.

Why CGPAAmortizedAnalysis?

On a 10-point, credit-weighted scale, the question every student eventually asks is "what do I need next semester to stay above 9?" The honest answer depends on how many credits you've already banked and how heavy the next semester is.

This app answers it for every credit load at once. It treats your grade-point surplus (or deficit) as something to amortize over the next semester's credits, the same bookkeeping as amortized analysis in algorithms. The full derivation is in docs/ALGORITHM.md.

Features

๐Ÿ“ Semester-by-semester entry

A swipeable eight-page pager, one card per semester, with GPA and credit fields. Input is checked for blanks and a 0โ€“10 GPA range before it counts.

๐Ÿ“Š Live GPA bar chart

Every submitted semester adds an animated bar to an MPAndroidChart BarChart labelled SEM 1โ€ฆSEM 8.

๐Ÿงฎ Credit-weighted CGPA

Recomputed after every entry as ฮฃ(GPA ร— credits) / ฮฃ credits, with a verdict line: "Go and Explore the world!" above 9, "Start Studying!" otherwise.

๐ŸŽฏ Minimum-GPA table

For next-semester loads of 16โ€“27 credits, the lowest GPA that keeps your CGPA at 9.0. It reads "Above 10" when that load can't get you there.

๐Ÿ“ˆ Amortized-analysis maths

g* = 9 + Cยท(9 โˆ’ CGPA) / n: your banked surplus or debt, spread over the next n credits. The derivation and examples are in ALGORITHM.md.

๐Ÿ” Event-driven MVC

Model / View / Controller packages wired with greenrobot EventBus. A sticky event hands the semester list to the estimate dialog.

Tech stack

Language & platform
Java Android compileSdk 23 minSdk 22

Libraries
MPAndroidChart v2.2.4 greenrobot EventBus 3.0.0 InkPageIndicator 1.1.1 Android Support Library 23.3.0

Architecture

flowchart LR
    GF["GPAFragment<br/>SEM 1 โ€ฆ SEM 8"] -->|"DataUpdateEvent"| MA["MainActivity"]
    MA --> CC["CalculateCGPA"]
    MA --> BC["BarChart<br/>one bar per semester"]
    MA -->|"sticky DataListEvent"| AD["AlertDialogFragment"]
    AD --> CAG["CalculateAmortizedGPA<br/>n = 16 โ€ฆ 27"]
    CAG --> CC
    AD --> AA["AmortizedAdapter<br/>RecyclerView rows"]
Loading

You enter a semester on a GPAFragment page, which posts a DataUpdateEvent through EventBus. MainActivity stores it, recomputes the CGPA, adds a bar, advances the pager, and opens AlertDialogFragment with the full list as a sticky event. The dialog builds the 16โ€“27-credit table. Package map, sequence diagram and lifecycle notes are in docs/ARCHITECTURE.md.

Quick start

Important

The repository contains only the app/ module. There is no root settings.gradle, build.gradle or Gradle wrapper, so you need to add them before Android Studio will open the project.

Era-faithful setup (2016 toolchain): Android Studio 2.x, JDK 8, SDK Platform 23, Build Tools 23.0.3 and the Android Support Repository. Use a device or emulator on API 22+.

  1. Clone

    git clone https://github.com/abhinav-adtechs/CGPAAmortizedAnalysis.git
    cd CGPAAmortizedAnalysis
  2. Add the two missing root files. These are period-appropriate versions; AGP 2.1.x was current in May 2016:

    settings.gradle

    include ':app'

    build.gradle

    buildscript {
        repositories { jcenter() }
        dependencies { classpath 'com.android.tools.build:gradle:2.1.0' }
    }
    allprojects {
        repositories { jcenter() }
    }
  3. Open the folder in Android Studio and accept its offer to set up the Gradle wrapper. Then run the app configuration.

  4. Try the built-in sample. Enter the four semesters that AlertFragment hard-codes, one per page, tapping Add GPA each time:

    Page GPA Credits
    SEMESTER 1 9.4 24
    SEMESTER 2 9.3 26
    SEMESTER 3 9.2 24
    SEMESTER 4 9.0 24

    The last dialog should list a minimum GPA of about 7.61 for 16 credits, rising to about 8.18 for 27. The verdict line should show a CGPA of about 9.23. ALGORITHM.md ยง6 works through the numbers.

Tip

Using a current Android Studio? jcenter has been retired and the 2016 Gradle plugin won't run on modern JDKs. The least painful route is a fresh Empty Views Activity project (Java, package abhinav.hackdev.co.amortizedanalysis, min SDK 22). Copy app/src/main/java and app/src/main/res into it and add the dependencies with modern coordinates:

  • implementation instead of compile
  • AndroidX (androidx.appcompat:appcompat, androidx.recyclerview:recyclerview, and androidx.legacy:legacy-support-v13 for the framework-fragment FragmentPagerAdapter), then update the android.support.* imports to their androidx.* equivalents
  • org.greenrobot:eventbus from Maven Central
  • MPAndroidChart v2.2.4 from JitPack (the v3 API differs)

If ink-page-indicator:1.1.1 no longer resolves, remove the indicator from activity_main.xml and MainActivity. It is cosmetic.

Configuration

No environment variables or settings screen. The behaviour is fixed by these constants:

What Value Where
Target CGPA 9 Model/Entities/CalculateAmortizedGPA.java L30, dialog title in res/layout/fragment_alert_amortized.xml
Next-semester credit loads 16โ€“27 View/Fragments/AlertDialogFragment.java L80
Number of semesters 8 Controller/CustomAdapter.java L28, chart labels in MainActivity.java L94โ€“96
Valid GPA range 0โ€“10 View/Fragments/GPAFragment.java L68
Verdict threshold CGPA > 9 View/Activities/MainActivity.java L158

(Paths relative to app/src/main/java/abhinav/hackdev/co/amortizedanalysis/ unless they start with res/.)

Project structure

CGPAAmortizedAnalysis/
โ”œโ”€โ”€ app/
โ”‚   โ”œโ”€โ”€ build.gradle                         # SDK 23, minSdk 22, dependencies
โ”‚   โ””โ”€โ”€ src/main/
โ”‚       โ”œโ”€โ”€ AndroidManifest.xml
โ”‚       โ”œโ”€โ”€ java/abhinav/hackdev/co/amortizedanalysis/
โ”‚       โ”‚   โ”œโ”€โ”€ Controller/
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ CustomAdapter.java       # 8-page semester pager adapter
โ”‚       โ”‚   โ”‚   โ””โ”€โ”€ AmortizedAdapter.java    # minimum-GPA table rows ("Above 10" clamp)
โ”‚       โ”‚   โ”œโ”€โ”€ Model/
โ”‚       โ”‚   โ”‚   โ”œโ”€โ”€ Entities/
โ”‚       โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ CalculateCGPA.java          # โ˜… credit-weighted CGPA
โ”‚       โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ CalculateAmortizedGPA.java  # โ˜… minimum GPA for next semester
โ”‚       โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ GPAData.java ยท EstimatedList.java ยท GPAList.java
โ”‚       โ”‚   โ”‚   โ””โ”€โ”€ EventBusEvents/
โ”‚       โ”‚   โ”‚       โ””โ”€โ”€ DataUpdateEvent.java ยท DataListEvent.java
โ”‚       โ”‚   โ””โ”€โ”€ View/
โ”‚       โ”‚       โ”œโ”€โ”€ Activities/MainActivity.java     # pager, bar chart, verdict
โ”‚       โ”‚       โ”œโ”€โ”€ Fragments/GPAFragment.java       # one semester's input card
โ”‚       โ”‚       โ”œโ”€โ”€ Fragments/AlertDialogFragment.java  # estimate dialog
โ”‚       โ”‚       โ”œโ”€โ”€ Fragments/AlertFragment.java     # demo activity with sample data
โ”‚       โ”‚       โ””โ”€โ”€ CustomViews/CustomViewPager.java
โ”‚       โ””โ”€โ”€ res/layout/                      # activity_main, fragment_gpa, fragment_alert_amortized, list_item
โ””โ”€โ”€ docs/
    โ”œโ”€โ”€ ALGORITHM.md                         # derivation, amortized view, worked examples
    โ””โ”€โ”€ ARCHITECTURE.md                      # packages, event flow, build config

Docs

Document What's inside
docs/ALGORITHM.md CGPA and minimum-GPA formulas with line references, the aggregate/potential-method view of "amortized", reachability bound, worked examples, edge cases
docs/ARCHITECTURE.md MVC package map, EventBus sequence diagram, lifecycle notes, build configuration
CHANGELOG.md Release history derived from the commit log

Roadmap

  • Fix double counting when a semester is submitted twice
  • Fix the crash when a later semester is entered before earlier ones
  • Validate credits (> 0) so the CGPA can't become NaN
  • Make the target CGPA configurable instead of a hard-coded 9
  • Spread the deficit over several remaining semesters when one isn't enough ("Above 10")
  • Unit tests for CalculateCGPA and CalculateAmortizedGPA
  • Add root Gradle files and migrate the build to current AGP/AndroidX
  • Persist entered semesters across rotation and restarts

Contributing

Issues and PRs are welcome, especially anything on the roadmap. See CONTRIBUTING.md for setup, commit conventions and the PR checklist.

License

MIT ยฉ 2016โ€“2026 Abhinav Das. See LICENSE.

Star history

Star history chart


Built by Abhinav Das
If this project helped you, consider giving it a โญ

About

2016 Android app: the minimum GPA you need next semester to hold a 9.0 CGPA, worked out amortized-analysis style

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

11 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages