Bellow is what i have so far on my assignment. I need some help getting this application working. Thank you for your time!

/**
General Assignment:
Review the grading policy on the CSCI 181 syllabus.  
The course grade is determined by the weighted average of six components with two possible penalties added.
The six components with associated weights are Homework (5%), FeedBack Surveys(5%),  Class Labs(10%), Programs(20%), Exams(30%), and Final(30%).  
If the value for the program component is less than a C (14.5%), a penalty of -24(*programScore - 14.5)/14.5 is added to final grade. 
If the value of the final exam component is less than a C (21.75%), a penalty of -24*(finalScore - 21.75)/21.75 is added to final grade. 
Write a program that will allow the user to enter possible and actual points for each component, compute the course average, and assign a
letter grade according to the following table:

A :  92.50%+    
B+:  86.50%
C+:  76.50%
D+: 66.50%
F:  below 59.50%
A-:  89.50%
B:    82.50%
C:    72.50%
D:   59.50%


B-:   79.50%
C- :  69.50%


 */



import java.util.Scanner;
import java.text.DecimalFormat;

public class CsciGradeCalculator {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {


        Scanner keyboard = new Scanner(System.in);//import scanner

        //prompts 
        System.out.print("CS181 Grade Calculator\n\n");

        System.out.print("Please enter possible & actual points for exercises: ");
        double exercisesPossible = keyboard.nextDouble();
        double exercisesActual = keyboard.nextDouble();
        System.out.print("Please enter possible & actual points for feedback: ");
        double feedbackPossible = keyboard.nextDouble();
        double feedbackActual = keyboard.nextDouble();        
        System.out.print("Please enter possible & actual points for labs: ");
        double labsPossible = keyboard.nextDouble();
        double labsActual = keyboard.nextDouble();
        System.out.print("Please enter possible & actual points for programs: ");
        double programsPossible = keyboard.nextDouble();
        double programsActual = keyboard.nextDouble();       
        System.out.print("Please enter possible & actual points for exams: ");
        double examsPossible = keyboard.nextDouble();
        double examsActual = keyboard.nextDouble();
        System.out.print("Please enter possible & actual points for final: ");
        double finalPossible = keyboard.nextDouble();
        double finalActual = keyboard.nextDouble();
        keyboard.close(); 

        //calculate
        double exercisesResults = exercisesActual / exercisesPossible;
        double feedbackResults = feedbackActual / exercisesPossible;
        double labsResults = labsActual / labsPossible;
        double programsResults = programsActual / programsPossible;
        double examsResults = examsActual / examsPossible;
        double finalResults = finalActual / finalPossible;



        // weights: Homework (5%), FeedBack Surveys(5%),  Class Labs(10%), Programs(20%), Exams(30%), and Final(30%).   
        double exercisesWeight =  0.05;
        double feedbacklWeight =  0.05;
        double labsWeight =  0.10;
        double programslWeight =  0.20;
        double examsWeight =  0.30;
        double finalWeight =  0.30;

       int programPenalty;
       int finalPenalty; 


        //calculate grade letter
        String letter;

        if(finalResults>=92.5){
           letter="A";
        System.out.println(letter);
        }

        else if(finalResults>=89.5){
           letter="A-";
           }

        else if(finalResults>=86.5){
           letter="B+";
           }

        else if(finalResults>=82.5){
           letter="B";
           }

        else if(finalResults>=79.5){
           letter="B-";
           }

        else if(finalResults>=76.5){
           letter="C+";
           }

        else if(finalResults>=72.5){
           letter="C";
           }

        else if(finalResults>=69.5){
           letter="C-";
           }

        else if(finalResults>=66.5){
           letter="D+";
           }

        else if(finalResults>=59.5){
           letter="D"; 
           }
        else{
           letter="F";
           }


        //results
       System.out.println("\nComponent\t\0|Weight |\0Possible |\0Actual |\0Score");
       System.out.printf("=======================================================================\n");
       System.out.printf("Exercises       |   %f |       %f |     %f |  %f  \n", exercisesWeight, exercisesPossible, exercisesActual, exercisesResults);
       System.out.printf("Feedback        |   %f |       %f |     %f |  %f  \n", feedbacklWeight, feedbackPossible, feedbackActual, feedbackResults);       
       System.out.printf("Labs            |   %f |       %f |     %f |  %f  \n", labsWeight, labsPossible, labsActual, labsResults );        
       System.out.printf("Programs        |   %f |       %f |     %f |  %f  \n", programslWeight, programsPossible, programsActual, programsResults);        
       System.out.printf("Exams           |   %f |       %f |     %f |  %f  \n", examsWeight, examsPossible, examsActual, examsResults);                
       System.out.printf("Final           |   %f |       %f |     %f |  %f  \n", finalWeight, finalPossible, finalActual, finalResults);   
       System.out.printf("Program Penalty |----------------------------|  3d  \n");  
       System.out.printf("Final Penalty   |----------------------------|  3d  \n"); 
       System.out.printf("========================================================================\n");
       System.out.printf("Course Average  |----------------------------|  %f \n", finalResults, letter);   


    }
}

Exactly what help do you need?
You know the drill...
full text of any error messages, or a complete description of how the actual behaviour differs from the desired.

My mind is mush... I am not gathering how to do the calculations for the penalty and incorperate all of that into the if statment then spit that to the output. I am not understanding what i need to do to move data around :\

My mind is mush...
Yeah - we've all had that feeling - when that happens a quick break and some fresh air often makes a big difference. Another approach is to explain your problem to someone who doesn't understand it all - by the time you've explained it to them you've explained it to yourself as well, and the solution is obvious.

If the value for the program component is less than a C (14.5%), a penalty of -24(*programScore - 14.5)/14.5 is added to final grade.

You already have a variable for the penalty, and the problem description spells out the if test and the calculation of the penalty - you just need to translate literally from English to Java. It's not part of any other "if". Just do the test, set the value of penalty (zero if no penalty) then deduct the penalty from the final grade at the end.

I am confused i have 2 variables programPenalty and finalPenalty. Do i need to remove those?

No. There are two penaties in the spec. I just referred to one of those, but they both work the same way.
(I'm finishing now for this evening, someone else will probably step in...)

Edited 4 Years Ago by JamesCherrill

I made some progress the math on the score part is wack and i canot figure out how to make the if statment calculate the penalties :\

/**
General Assignment:
Review the grading policy on the CSCI 181 syllabus.  
The course grade is determined by the weighted average of six components with two possible penalties added.
The six components with associated weights are Homework (5%), FeedBack Surveys(5%),  Class Labs(10%), Programs(20%), Exams(30%), and Final(30%).  
If the value for the program component is less than a C (14.5%), a penalty of -24(*programScore - 14.5)/14.5 is added to final grade. 
If the value of the final exam component is less than a C (21.75%), a penalty of -24*(finalScore - 21.75)/21.75 is added to final grade. 
Write a program that will allow the user to enter possible and actual points for each component, compute the course average, and assign a
letter grade according to the following table:
A :  92.50%+    
B+:  86.50%
C+:  76.50%
D+: 66.50%
F:  below 59.50%
A-:  89.50%
B:    82.50%
C:    72.50%
D:   59.50%
B-:   79.50%
C- :  69.50%
 */


import java.util.Scanner;
import java.text.DecimalFormat;
import java.text.*;

public class CsciGradeCalculator {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {

        Scanner keyboard = new Scanner(System.in);//import scanner

        //prompts 
        System.out.print("CS181 Grade Calculator\n\n");

        System.out.print("Please enter possible & actual points for exercises: ");
        double exercisesPossible = keyboard.nextDouble();
        double exercisesActual = keyboard.nextDouble();
        System.out.print("Please enter possible & actual points for feedback: ");
        double feedbackPossible = keyboard.nextDouble();
        double feedbackActual = keyboard.nextDouble();        
        System.out.print("Please enter possible & actual points for labs: ");
        double labsPossible = keyboard.nextDouble();
        double labsActual = keyboard.nextDouble();
        System.out.print("Please enter possible & actual points for programs: ");
        double programsPossible = keyboard.nextDouble();
        double programsActual = keyboard.nextDouble();       
        System.out.print("Please enter possible & actual points for exams: ");
        double examsPossible = keyboard.nextDouble();
        double examsActual = keyboard.nextDouble();
        System.out.print("Please enter possible & actual points for final: ");
        double finalPossible = keyboard.nextDouble();
        double finalActual = keyboard.nextDouble();
        keyboard.close();

        //calculate
        double exercisesResults = (exercisesActual / exercisesPossible) * 100;
        double feedbackResults = (feedbackActual / exercisesPossible) * 100;
        double labsResults = (labsActual / labsPossible) * 100;
        double programsResults = (programsActual / programsPossible) * 100;
        double examsResults = (examsActual / examsPossible) * 100;
        double finalResults = (finalActual / finalPossible) * 100;

        // weights: Homework (5%), FeedBack Surveys(5%),  
        // Class Labs(10%), Programs(20%), Exams(30%), and Final(30%).  
        double exercisesWeight =  5;
        double feedbacklWeight =  5;
        double labsWeight =  10;
        double programslWeight =  20;
        double examsWeight =  30;
        double finalWeight =  30;

        double programPenalty = 0.0;
        double finalPenalty = 0.0;

           //calculate grade letter
        String letter = "A";

                if(finalResults>=92.5){
           letter="A";
        }

        else if(finalResults>=89.5){
           letter="A-";
           }

        else if(finalResults>=86.5){
           letter="B+";
           }

        else if(finalResults>=82.5){
           letter="B";
           }

        else if(finalResults>=79.5){
           letter="B-";
           }

        else if(finalResults>=76.5){
           letter="C+";
           }

        else if(finalResults>=72.5){
           letter="C";
           }

        else if(finalResults>=69.5){
           letter="C-";
           }

        else if(finalResults>=66.5){
           letter="D+";
           }

        else if(finalResults>=59.5){
           letter="D";
           }
       else{
           letter="F";
          }

        //format
        DecimalFormat whole = new DecimalFormat("#");
        DecimalFormat twoPlaces = new DecimalFormat("#.##");

       //results
       System.out.println("\nComponent       |Weight  | Possible | Actual | Score");
       System.out.printf("=======================================================================\n");
       System.out.printf("Exercises       |    %s%% |       %s |     %s |  %s  \n", whole.format(exercisesWeight), whole.format(exercisesPossible), whole.format(exercisesActual), twoPlaces.format(exercisesResults));
       System.out.printf("Feedback        |    %s%% |       %s |     %s |  %s  \n", whole.format(feedbacklWeight), whole.format(feedbackPossible), whole.format(feedbackActual), twoPlaces.format(feedbackResults));      
       System.out.printf("Labs            |   %s%% |       %s |     %s |  %s  \n", whole.format(labsWeight), whole.format(labsPossible), whole.format(labsActual), twoPlaces.format(labsResults));        
       System.out.printf("Programs        |   %s%% |       %s |     %s |  %s  \n", whole.format(programslWeight), whole.format(programsPossible), whole.format(programsActual), twoPlaces.format(programsResults));        
       System.out.printf("Exams           |   %s%% |       %s |     %s |  %s  \n", whole.format(examsWeight), whole.format(examsPossible), whole.format(examsActual), twoPlaces.format(examsResults));                
       System.out.printf("Final           |   %s%% |       %s |     %s |  %s  \n", whole.format(finalWeight), whole.format(finalPossible), whole.format(finalActual), twoPlaces.format(finalResults));  
       System.out.printf("Program Penalty |----------------------------|  0  \n");  
       System.out.printf("Final Penalty   |----------------------------|  0  \n");
       System.out.printf("========================================================================\n");
       System.out.printf("Course Average  |----------------------------|  %.2f %s\n", finalResults, letter);  





    }
}

Edited 4 Years Ago by summey: cleaned up code

how to make the if statment calculate the penalties :\

Can you explain in English what the rules are for calculating the penalties?

If the value for the program component is less than a C (14.5%), a penalty of -24(programScore - 14.5)/14.5 is added to final grade. If the value of the final exam component is less than a C (21.75%), a penalty of -24(finalScore - 21.75)/21.75 is added to final grade.

What part don't you understand?
if program component is less than a C (14.5%)
Compute penalty: -24(programScore - 14.5)/14.5
add to score

so i need a new if statment or do i add this to the one i already have? I understand the concept i just dont know how to interprate it into code

        //calculate grade letter
        String letter;
        if(finalResults>=92.5){
           letter="A";
        System.out.println(letter);
        }
        else if(finalResults>=89.5){
           letter="A-";
           }
        else if(finalResults>=86.5){
           letter="B+";
           }
        else if(finalResults>=82.5){
           letter="B";
           }
        else if(finalResults>=79.5){
           letter="B-";
           }
        else if(finalResults>=76.5){
           letter="C+";
           }
        else if(finalResults>=72.5){
           letter="C";
           }
        else if(finalResults>=69.5){
           letter="C-";
           }
        else if(finalResults>=66.5){
           letter="D+";
           }
        else if(finalResults>=59.5){
           letter="D"; 
           }
        else{
           letter="F";
           }
This article has been dead for over six months. Start a new discussion instead.