February 1, 2017

Calculation error

So right now my code takes in 7 assignments, 10 labs and the midterms and finals that the user entered the percentage for, the thing is, in most of the methods to calculate the weighted grades are wrong and im not too great on figuring out how to fix it, its supposed to add up to 100% overall. Would any of you be able to help?

here is my code so far:

PHP Code:
package assignments;

import java.util.Scanner;

public class Assignment3 {

public static void main(String[] args){
    
        
        
System.out.println("C O U R S E  G R A D E  C A L C U L A T O R");
        
System.out.println();
        
        
System.out.println("Purpose: Calculated the weighted grade for a student in a course");
        
System.out.println("Inputs: Assignment, Lab and Exam grades");
        
System.out.println();
        
System.out.println("Passing Grade for Final ===> 47");    
        
System.out.println();
        
double Grade1 Assignments();
        
double Grade2 Labs();
        
double Grade3 Midterms();
        
double Grade4 = Final();
        
System.out.println(Grade1 Grade2 Grade3 Grade4);
        
double TotalGrade = ((Grade1 Grade2 Grade3 Grade4));
        
double TotalGradeAVG = (TotalGrade/1668.00)*100;
        
LetterGrade(TotalGradeAVG);
    }

public static double Calculation(String xint numrowsint maximum){
    
    
System.out.println();
    
System.out.println("Input "+" (Maximum "+maximum+"): ");
    
Scanner stdin = new Scanner(System.in); 
    
double total 0;
        for(
int i=1;i<=numrows;i++){
            
System.out.print("#"+i+"===>");
            
double input =stdin.nextDouble();
            if(
input<=maximum && input>=0){
            
total += input;
            
            }
            else{
                
System.out.println("Incorrect input, Try again:");
                
i--;
            }
            
        }
        
        
//System.out.println(total);
        
return total;
}
public static 
double Assignments(){
    
double AssTotal 0;
    
double grade Calculation("Assignments"710);
    
AssTotal AssTotal + (grade/10) * 3//weighted calculation  Assignments: 7 worth 3% each -> 21% 
    
return AssTotal;
}
public static 
double Labs(){
    
double LabTotal 0;
    
double grade Calculation("Labs"101);
    
LabTotal += (grade*.05)/10;//weighted calculation Labs: 10 worth 0.5% each -> 5%
    
return LabTotal;
    
    
}
public static 
double Midterms(){
    
double MidTotal 0;
    
double grade Calculation("Midterms"2100);
    
MidTotal += (grade*16)/2;//weighted calculation Midterm Exams: 2 worth 16% each -> 32% 
    
return MidTotal;
}
public static 
double Final(){
    
double FinTotal 0;
    
double grade Calculation("Final"1100);
    
FinTotal += (grade/*.42);   //weighted calculation Final Exam: 42%
    
return FinTotal;
    
}

public static void LetterGrade(double mark){
    
    
System.out.println(mark);
    if(
mark<=49){
        
System.out.println("Grade = " mark " F");
    }
    if(
mark>= 50 && mark<=59){
        
System.out.println("Grade = " mark " C-");
    }
    if(
mark>= 60 && mark<=64){
        
System.out.println("Grade = " mark " C");
    }
    if(
mark>= 65 && mark<=69){
        
System.out.println("Grade = " mark " C+");
    }
    if(
mark>= 70 && mark<=72){
        
System.out.println("Grade = " mark " B-");
    }
    if(
mark>= 73 && mark<=76){
        
System.out.println("Grade = " mark " B");
    }
    if(
mark>= 77 && mark<=89){
        
System.out.println("Grade = " mark " B+");
    }
    if(
mark>= 80 && mark<=84){
        
System.out.println("Grade = " mark " A-");
    }
    if(
mark>= 85 && mark<=89){
        
System.out.println("Grade = " mark " A");
    }
    if(
mark>= 90 && mark<=100){
        
System.out.println("Grade = " mark " A+");
    }
}

Category : Uncategorized

Leave a Reply

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

Proudly powered by Bolkya Resha and Software Testing Theme