Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program to calculate your current grade based on this: Exams =45% Assign

ID: 3543636 • Letter: W

Question

Write a program to calculate your current grade based on this:

Exams =45%
Assignments=40%
Final Exam=15%

Final grades will be determined as follows:
93-100=A 80-82=B- 67-69= D+
90-92=A- 77-79= C+ 63-66= D
87-89=B+ 73-76=C 60- 62=D-
83-86=B 70-72= C- 00- 59 =F

The program should prompt the user for their first and last name. It will then pass those names as Strings to the second method calcGrade of the CSE1341Grade class.


The calcGrade will accept the two String references as input parameters and it will create arrays for each of the categories which would help determine the final grade. All the arrays must be initialized to a value of -1.


Once all the arrays are created, the calcGrade method will invoke the 3rd method of this class named getScores. This new method will accept all the arrays created in calcGrade method as input parameters. For example, the getScores method may be passed an examArray, a finalArray, and a assignmentsArray to be populated with the scores.


The getScores method will prompt the user for the count of exam scores, count of final scores, and count of assignment scores based on what has already been graded.


The getScores method will utilize repetition structures to prompt the user to enter specfic scores based on the count of each category provided and not the length of the arrays.


Inside getScores method, create an arrays countArray to hold the counts of each of the categories provided by the user. The size of this array will be equal to the number of categories per the grading system above.


The getScores method will return the counterArray back to the calling method which will be utilized by the caller to calculate the current grade.


The calcGrade method will utilize the specific arrays to calculate averages for each of the categories and apply the necessary weights based on the grading system above.


The program will need to include and addition method outside of main() as below:

Method: Signature:

calcGrade public static void calcGrage(String first, String last)

getScores public static int [ ] getScores(int [ ] exams, int [ ] quizzes, int [ ] labs)


Assume all grades are out of 100pts each. Include comments for each block of code!


SAMPLE Run:


Enter First Name: James

Enter Last Name: Bond

How many Finals: 1

How many Exams: 2

How many Assignments: 9

Enter final grade:

Enter exam grade:

enter exam grade:

enter assignment grade:

enter assignment grade:

enter assignment grade:

enter assignment grade:

enter assignment grade:

enter assignment grade:

enter assignment grade:

enter assignment grade:

enter assignment grade:

Average grade is:

James Bond you letter grade is:


Explanation / Answer

import java.util.*;

import java.lang.*;

import java.io.*;


class CSE1341Grad

{

public static int [ ] getScores(int [ ] exams, int [ ] finals, int [ ] assignments)

{

Scanner scan = new Scanner(System.in);

System.out.println("How many Finals? ");

int f = new Integer(scan.nextLine());

System.out.println("How many Exams? ");

int e = new Integer(scan.nextLine());

System.out.println("How many Assignments? ");

int a = new Integer(scan.nextLine());

int countArray[] = new int[3];

countArray[0] = f;

countArray[1] = e;

countArray[2] = a;

int i = 0;

while(f!=0)

{

System.out.println("Enter Final Grade: ");

finals[i] = new Integer(scan.nextLine());

i++;

f--;

}

i = 0;

while(e!=0)

{

System.out.println("Enter Exam Grade: ");

exams[i] = new Integer(scan.nextLine());

i++;

e--;

}

i = 0;

while(a!=0)

{

System.out.println("Enter Assignment Grade: ");

assignments[i] = new Integer(scan.nextLine());

i++;

a--;

}

return countArray;

}

public static void calcGrage(String first, String last)

{

int exams[] = new int[100];

int finals[] = new int[100];

int assignments[] = new int[100];

int temp = 0;

while(temp<100)

{

exams[temp] = -1;

finals[temp] = -1;

assignments[temp] = -1;

temp++;

}

int scores[] = getScores(exams,finals,assignments);

Double Exam = 0.0,Final = 0.0,Assignment = 0.0;

int i=0;

while(i<scores[1])

{

Exam += exams[i];

i++;

}

Exam = Exam/scores[1];

i=0;

while(i<scores[0])

{

Final += finals[i];

i++;

}

Final =Final/scores[0];

i=0;

while(i<scores[2])

{

Assignment += assignments[i];

i++;

}

Assignment =Assignment/scores[2];

Double total = (45*Exam)/100 + (40*Assignment)/100 + (15*Final)/100 ;

String grade;

System.out.println("Average Grade is : "+ total);

if(93<= total && total<= 100)

grade = "A";

else if(90<= total && total<= 92)

grade = "A-";

else if(87<= total && total<= 89)

grade = "B+";

else if(83<= total && total<= 86)

grade = "B";

else if(80<= total && total<= 82)

grade = "B-";

else if(77<= total && total<= 79)

grade = "C+";

else if(73<= total && total<= 76)

grade = "C";

else if(70<= total && total<= 72)

grade = "C-";

else if(67<= total && total<= 69)

grade = "D+";

else if(63<= total && total<= 66)

grade = "D";

else if(60<= total && total<= 62)

grade = "D-";

else

grade = "F";

System.out.println(first + " " + last + " your letter Grade is : " + grade);

}

public static void main (String[] args)

{

Scanner scan = new Scanner(System.in);

System.out.println("Enter First Name: ");

String first = scan.nextLine();

System.out.println("Enter Last Name: ");

String last = scan.nextLine();

calcGrage(first, last);

}

}


Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote