Semester Grade Calculator

JAVA Programming Language LogoAs we are coming out of Thanksgiving break, I have given my students a “review” project that covers many of the topics that we have covered up to this point in the year.

The goal of the project is to allow for students to enter their Q1 report card grade and their current Q2 in-progress grade and calculate the minimum semester exam grade needed to achieve a final grade of a “C”, a “B”, and an “A”.

The students were given the following “starter” code to work from:

//Program Name: Unit 1 & 2 Review
//Programmer Name: Eric Evans, M.Ed.
//Programmer Organization: Ferris High School
//Program Date: Fall 2016

import java.util.*;
import java.lang.*;
import java.io.*;

public class gradecalculator{
    public static void main (String[] args){
        int runAgain = 1;
        while (runAgain == 1){
            System.out.println("** Minimum Grade Calculator **");
            Scanner q1 = new Scanner(System.in);
            System.out.print("Enter Your Q1 Report Card Grade_ ");
            double myQ1Grade = q1.nextDouble();
            //Copy line 15 and modify for PR4 grade
            //Copy line 16 and modify for PR4 grade
            //Copy line 17 and modify for PR4 grade
            double c = ((69.5 - ((myQ1Grade * 0.45) + (myPR4Grade * 0.45)))/0.10);
            //Copy line 21 and modify for a grade of a b
            //Copy line 22 and modify for a grade of an a
            System.out.println("With a Q1 grade of " + myQ1Grade + " and PR4 grade of " + myPR4Grade + ":");
            System.out.println("");
            System.out.println("To score a C, you will need a minimum of a " + c + " on the semester exam.");
            //Copy line 26 and modify for a grade of a b
            //Copy line 27 and modify for a grade of an a
            System.out.pringln("");
            System.out.println("** NOTE: Negative grades indicate the exam could be skipped");
            System.out.println("** NOTE: Grades over 100 indicate this average cannot be achieved");
            System.out.println("");
            Scanner runItAgain = new Scanner(System.in);
            System.out.println("Would You Like to Perform Another Calculation?");
            System.out.print("1 - Yes  /  0 - No : _ ");
            runAgain = runItAgain.nextInt();
        }
        System.out.println("");
        System.out.println("Program Complete - Exiting");
    }
}

This particular project requires students to utilize their knowledge of working with integer and double variables, scanner keyboard inputs, Boolean logic operators, and iteration loops.

Following this review, students will receive their first exposure to object oriented programming with a multi-class application and methods.

Following is a possible completed solution for the application:

//Program Name: Unit 1 & 2 Review
//Programmer Name: Eric Evans, M.Ed.
//Programmer Organization: Ferris High School
//Program Date: Fall 2016

import java.util.*;
import java.lang.*;
import java.io.*;

public class gradecalculator{
    public static void main (String[] args){
        int runAgain = 1;
        while (runAgain == 1){
            System.out.println("**Minimum Grade Calculator**");
            Scanner q1 = new Scanner(System.in);
            System.out.print("Enter Your Q1 Report Card Grade_ ");
            double myQ1Grade = q1.nextDouble();
            Scanner pr4 = new Scanner(System.in);
            System.out.print("Enter Your PR4 Report Card Grade_ ");
            double myPR4Grade = pr4.nextDouble();
            double c = ((69.5 - ((myQ1Grade * 0.45) + (myPR4Grade * 0.45)))/0.10);
            double b = ((79.5 - ((myQ1Grade * 0.45) + (myPR4Grade * 0.45)))/0.10);
            double a = ((89.5 - ((myQ1Grade * 0.45) + (myPR4Grade * 0.45)))/0.10);
            System.out.println("With a Q1 grade of " + myQ1Grade + " and PR4 grade of " + myPR4Grade + ":");
            System.out.println("");
            System.out.println("To score a C, you will need a minimum of a " + c + " on the semester exam.");
            System.out.println("To score a B, you will need a minimum of a " + b + " on the semester exam.");
            System.out.println("To score an A, you will need a minimum of a " + a + " on the semester exam.");
            System.out.println("");
            System.out.println("** NOTE: Negative grades indicate the exam could be skipped");
            System.out.println("** NOTE: Grades over 100 indicate this average cannot be achieved");
            System.out.println("");
            Scanner runItAgain = new Scanner(System.in);
            System.out.println("Would You Like to Perform Another Calculation?");
            System.out.print("1 - Yes  /  0 - No : _ ");
            runAgain = runItAgain.nextInt();
        }
        System.out.println("");
        System.out.println("Program Complete - Exiting");
    }
}

 

Leave a Reply

Your email address will not be published. Required fields are marked *