<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Victor Sunday on Medium]]></title>
        <description><![CDATA[Stories by Victor Sunday on Medium]]></description>
        <link>https://medium.com/@chiemezie554?source=rss-137f31714777------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*ydqeboHJa-v2-ieh</url>
            <title>Stories by Victor Sunday on Medium</title>
            <link>https://medium.com/@chiemezie554?source=rss-137f31714777------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 11:14:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chiemezie554/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[My Java GPA Calculator Project]]></title>
            <link>https://medium.com/@chiemezie554/my-java-gpa-calculator-project-396fac6d0dc5?source=rss-137f31714777------2</link>
            <guid isPermaLink="false">https://medium.com/p/396fac6d0dc5</guid>
            <dc:creator><![CDATA[Victor Sunday]]></dc:creator>
            <pubDate>Fri, 05 Sep 2025 12:05:03 GMT</pubDate>
            <atom:updated>2025-09-05T12:05:03.493Z</atom:updated>
            <content:encoded><![CDATA[<p>When I started learning <strong>Object-Oriented Programming (OOP) in Java</strong>, one of the assignments I got was to create a <strong>GPA Calculator</strong>. The program should allow a student to enter details about their courses, and then calculate their GPA based on grades and credit units.</p><p>At first, this looked very difficult. But step by step, I was able to build it, fix errors, and improve the code. Below, I will explain the whole journey — from the beginning to the end.</p><p><strong>Step 1: Understanding the Requirements:</strong></p><p>The problem was simple in words:</p><ol><li>Ask the student for the number of courses.</li></ol><p>2. For each course, ask for details like:</p><ul><li>Course name</li><li>Course code</li><li>Credit units</li><li>Grade (A, B, C, D, E, F)</li><li>Semester (First/Second)</li><li>Session (e.g., 2022–2023)</li><li>Level (100, 200, 300, 400)</li></ul><p>3. Use grades and credit units to calculate the <strong>GPA</strong>.</p><p>4. Show the result to the student.</p><p>5. Ask if the student wants to calculate another GPA.</p><p><strong>We also had to make the program Object-Oriented. This means instead of writing everything inside </strong><strong>main, we created different classes:</strong></p><ul><li>Course class → holds information about each course.</li><li>GPACalculator class → does the main logic of asking questions and calculating GPA.</li><li>Main class → starts the program.</li></ul><h3>Step 2: Writing the First Code</h3><p>At first, we wrote a simple code that could ask for courses, credit units, and grades. We mapped grades like this:</p><ul><li>A → 5.0</li><li>B → 4.0</li><li>C → 3.0</li><li>D → 2.0</li><li>E → 1.0</li><li>F → 0.0</li></ul><p>Then we multiplied grade points by credit units to get <strong>total grade points</strong>, and divided by total credits to get the <strong>GPA</strong>.</p><p>This worked, but it was only the beginning.</p><h3>Step 3: Errors We Faced</h3><p>When testing the program, we faced many <strong>errors and challenges</strong>:</p><ol><li><strong>No Main Class Error in NetBeans</strong></li></ol><ul><li>At first, NetBeans said <em>“No main class found”</em>.</li><li>We solved this by making sure our Main class had a public static void main(String[] args) method.</li></ul><p><strong>2. Skipping Input Problem</strong></p><ul><li>When we entered course names, the program sometimes skipped the input and jumped straight to credit units.</li><li>This happened because scanner.nextInt() leaves a hidden newline (\n) in memory.</li><li>We solved it by adding scanner.nextLine() after reading numbers.</li></ul><p><strong>3. Loop Not Working</strong></p><ul><li>The program ran only once and ended.</li><li>We solved it by adding a while(true) loop with askToContinue(), so the program asks <em>“Would you like to calculate another GPA (yes/no)?”</em>.</li></ul><p><strong>4. Error Controls</strong></p><ul><li>At first, the program accepted anything — empty names, wrong grades, or wrong registration numbers.</li></ul><p>We added validations:</p><ul><li>Course names must be letters only.</li><li>Grades must be A, B, C, D, E, or F.</li><li>Credit units must be between 1 and 6.</li><li>Semester must be “First” or “Second”.</li><li>Level must be 100, 200, 300, or 400.</li><li>Registration number must follow the format YYYY/XXXXXX (like 2022/242711).</li></ul><h3>Step 4: Making the Code Unique</h3><p>My tutor wanted the program to be <strong>unique</strong>. So, we added a special rule:</p><ul><li>If the student is in <strong>100 level</strong>, the GPA is normal (just for that level).</li><li>If the student is in <strong>200 level</strong>, the GPA must include 100 + 200 level courses.</li><li>If the student is in <strong>300 level</strong>, the GPA must include 100 + 200 + 300 level courses.</li><li>If the student is in <strong>400 level</strong>, it must include all 100–400 level courses.</li></ul><p>This made the program more realistic, because in universities, GPAs are <strong>cumulative</strong> from 200 level upwards.</p><h3>Step 5: Final Touches</h3><p>We added more details to make the program professional:</p><ul><li>Registration number with error control.</li><li>Sessions (like 2022–2023).</li><li>Error handling everywhere so the program never crashes.</li><li>In the end, the program was complete and user-friendly.</li></ul><h3>Lessons I Learned</h3><ol><li><strong>Always validate user input</strong> — users can type anything, so we must handle errors.</li><li><strong>Scanner issues</strong> — when mixing nextInt() and nextLine(), always clear the buffer with scanner.nextLine().</li><li><strong>OOP makes programs cleaner</strong> — separating Course, GPACalculator, and Main made the code easier to manage.</li><li><strong>Programming is about fixing errors</strong> — every error we faced was a chance to learn something new.</li></ol><h3>Conclusion</h3><p>The GPA Calculator project was a journey full of challenges, errors, and fixes. In the beginning, I struggled with missing classes, input problems, and loops. But step by step, I fixed each error, added error controls, and made the program unique with cumulative GPA logic.</p><p>Now, the program works smoothly, is easy to use, and can even handle real-life GPA calculations.</p><p>This project taught me that programming is not about writing perfect code the first time — it’s about writing, testing, failing, and fixing until it works.</p><h3>Sample Run of the GPA Calculator</h3><p>Here is an example of how the program runs in the console:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4e_S0Q81I1AfQNIR1HPqug.png" /></figure><h3>Explanation of the Sample Run</h3><ol><li>The program <strong>asks for session, level, and registration number</strong>.</li><li>The student enters <strong>courses one by one</strong> with all their details.</li><li>The program calculates the <strong>GPA</strong> using grades and credit hours.</li><li>At the end, the student can <strong>choose to calculate again or exit</strong>.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=396fac6d0dc5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>