Learning & study

Build a GPA calculator app that tells you what you need in finals

A student build brief for a GPA and CGPA calculator: add subjects and credits, pick your grading scale, and see the final exam score you need to hit your target.

Apirex TeamUpdated WebAndroidiOS
On this page
  1. Screens
  2. Data model
  3. Native features
  4. Android notes (Kotlin and Jetpack Compose)
  5. iPhone notes (Swift and SwiftUI)
  6. Web notes (best fit)
  7. Copy-paste prompt
  8. Acceptance test
  9. Frequently asked questions
5screens
4data tables
163word prompt
3platforms: Web, Android, iOS

Every semester has that late-night moment of opening a spreadsheet to work out whether an 8.5 is still possible. This brief builds a calculator that answers it properly: add your subjects with credits, enter the marks you already have, pick your university's grading scale, and the app tells you the score you need in each final to reach your target. The best fit is a web app that a whole class can open from one link and use offline. Android and iPhone versions are easy too, and the iPhone build needs a Mac with Xcode. Grading rules differ between universities, so the brief makes the scale editable instead of guessing. The first proof: a worked example checked by hand matches the app to two decimal places.

Screens

  • Semester: Subjects with credits, marks so far and the grade or score each is heading for.
  • Target: Enter the GPA or CGPA you want and see the final exam score needed per subject.
  • Scale: Choose a 10-point, 4.0 or custom scale, with editable grade bands and points.
  • History: Past semesters and the running cumulative figure.
  • Share: A clean summary card to send to a friend or a parent, without marks you choose to hide.

Data model

Grade data saved on the device
TableKey fieldsPurpose
scalesid (uuid), name (text), max_points (numeric), bands (jsonb)Grade bands such as 90–100 is O with 10 points, editable to match any university.
semestersid (uuid), label (text), position (int), scale_id (uuid)Each term in order, tied to the scale it was graded on.
subjectsid (uuid), semester_id (uuid), name (text), credits (numeric), internal_score (numeric), internal_weight (numeric), final_score (numeric)A course with its credits, the marks already earned and how much the final exam counts.
targetsid (uuid), semester_id (uuid), target_points (numeric)The GPA the student is aiming for this term.

Everything stays on the device: marks are personal, and nothing here needs a server. On the web, save to localStorage or IndexedDB and offer an export file so a student switching phones keeps their history. Natively, use Room or SwiftData. Keep the maths in one pure function with tests, because a calculator that is off by a rounding rule is worse than no calculator. If a class later wants to share a scale preset, publish it as a file or link rather than adding accounts.

Native features

The useful part is working backwards. For each subject, the app knows the internal marks and their weight, the final exam's weight and the grade bands, so it can find the lowest final score that reaches the band each subject needs. Across subjects, it should show one sensible plan to hit the target and flag when the target is impossible even with full marks, instead of showing a number above 100.

FeatureAndroid (Kotlin)iPhone (SwiftUI)Notes
Saving marksRoom tables with a Flow for totalsSwiftData models with computed totalsOn web, IndexedDB with an export and import file.
Number entryDecimal keyboard with input validationdecimalPad keyboard with a formatterAccept both comma and dot decimal separators.
Summary cardCompose layout drawn to a bitmap and sharedImageRenderer of a SwiftUI view and ShareLinkOn web, a canvas image or plain text for Web Share.
Deadline nudgeOptional WorkManager reminder before examsOptional local notificationOff by default; a calculator should not nag.

Android notes (Kotlin and Jetpack Compose)

Use BigDecimal for every calculation and round only for display, with the rounding rule taken from the chosen scale. Keep subject rows in a LazyColumn with clear credit and score fields, and recompute the target answer as the student types.

  • Write the required-score solver as a pure Kotlin function: for each band, compute the final score that would reach it given internal marks and weights, clamp at zero, and mark anything above the maximum as not reachable.
  • Validate inputs gently: credits above zero, scores within the scale's range, weights adding up to 100 per cent, with inline messages instead of blocking dialogs.
  • On a real phone, enter a semester from a real marksheet, compare the computed GPA with the official figure and adjust the scale bands until they match exactly.

iPhone notes (Swift and SwiftUI)

On iPhone, a Form with one section per subject and a sticky result bar at the bottom keeps the answer visible while typing. SwiftData can hold semesters and subjects, with the scale stored as Codable bands.

  • Use Decimal and NumberFormatter tied to the user's locale, and keep the solver in a plain Swift type with unit tests for edge cases such as zero-credit subjects.
  • Offer the summary card through ImageRenderer and ShareLink, with toggles to hide individual marks before sharing.
  • Test on an iPhone with a long subject list and the keyboard open; the result bar must stay visible and fields must scroll above the keyboard.

Web notes (best fit)

As a React and Vite web app with a manifest and offline caching, the calculator loads once and keeps working in an exam hall with poor signal. Keep the interface to one column on phones, with the required-score answer pinned where a thumb can see it.

  • Use inputmode=decimal on score fields so phones show a number pad, and parse values with the browser's locale in mind.
  • Version the export file format so a later update can still read history saved by an older version of the app.

Copy-paste prompt

Build this yourself 163 words · Web
Build a GPA calculator for my semester that tells me exactly what I need in finals to hit an 8.5 CGPA. Make it a web app my whole class can open from a link, and ready for Android or iPhone later. Screens: Semester, Target, Scale, History and Share. I add subjects with credits, my internal marks, how much internals and the final exam are worth, and the app shows the final score I need per subject. Let me pick a 10-point, 4.0 or custom scale with editable grade bands, because every university is different. If my target is impossible even with full marks, say so honestly. Keep past semesters and show my running CGPA. Save everything on my device with an export file, no account. Use exact decimal maths and round only for display. Make a clean summary card I can share, with an option to hide marks. Acceptance: a worked example I check by hand matches the app to two decimal places.

Opens Apirex with this prompt in the box. Pick the Web tab before you send.

Acceptance test

  1. Set up a 10-point scale with your university's bands and add four subjects with different credits and internal weights.
  2. Enter internal marks and a target of 8.5; work out one subject's required final score by hand and confirm the app agrees.
  3. Raise the target until it becomes unreachable and confirm the app says so instead of showing a score above the maximum.
  4. Add a second semester and confirm the cumulative figure is credit-weighted across both terms.
  5. Export the data, clear the browser storage, import the file and confirm everything comes back unchanged.

Test the rounding and scale rules against one real marksheet before sharing the link. If the university rounds each subject before averaging, or uses relative grading, the app should either support that rule or say clearly that its answer is an estimate for absolute grading.

Frequently asked questions

Will it match my university's official CGPA?

Only if the scale and rounding rules match. The brief makes grade bands, points and weights editable, so set them from your university's rules and check against one real marksheet.

Does it work for relative grading?

Not exactly. Relative grading depends on how the whole class scores, which a personal calculator cannot know. The app can still estimate using typical band cut-offs you enter.

Why build it as a web app first?

A link in the class group reaches everyone at once on any phone or laptop, and the maths needs no phone features. Native Android and iPhone versions are possible, and the iPhone build needs a Mac with Xcode.

Build this blueprint

The blueprint prompt, ready for your platform. Edit anything before you send it.

WebReact + ViteReal source on your computer

Opens Apirex with this prompt. Pick the Web tab before you send. The Free plan includes 5 Rex Credits a day.