Question Details

(solution) import java.util.Scanner; public class GradeCalculation { public


I am trying to calculate a class grade based off weights of certain assignments and the average of the user in these assignments. The program has certain requirements where if certain grades are not known it will move on to the next assignment grade. For example, there are 3 exams but if the score of the first exam is not known then the program jumps straight to asking about the lab average. I have gotten a proper code all the way up to the point of actually doing the math for the program to calculate the score. I am not sure how to go about doing this because I dont get how the formula would be able to account for that. I've attached my current code and the project requirements as well. 


import java.util.Scanner;

 

public class GradeCalculation {

 

public static void main(String args) {

 

Scanner keyboard=new Scanner(System.in);

 

String grade = "";

 

System.out.print(

 

"Grading Scale:

 

" +

 

"A

 

90 - 100

 

"+

 

"B

 

80 - 89

 

" +

 

"C

 

70 - 79

 

" +

 

"D

 

60 - 69

 

" +

 

"F

 

below 60

 

");

 

System.out.print("What letter grade do you want to receive?");

 

grade = keyboard.next();

 

switch (grade)

 

{

 

case "A":

 

case "a":

 

System.out.print("Enter Percentage Weights:

 

"); break;

 

case "B":

 

case "b":

 

System.out.print("Enter Percentage Weights:

 

"); break;

 

case "C":

 

case "c":

 

System.out.print("Enter Percentage Weights:

 

"); break;

 

case "D":

 

case "d":

 

System.out.print("Enter Percentage Weights:

 

"); break;

 

case "F":

 

case "f":

 

System.out.print("Enter Percentage Weights:

 

"); break;

 

default:

 

System.out.print("Input error");

 

System.exit(0); break;

 

}

 

double Exam1;

 

double Exam2;

 

double FinalExam;

 

double Labs;

 

double Projects;

 

double Attendance;

 

double Quizzes;

 

double score;

 

System.out.print(

 

"Exam 1:

 

");

 

Exam1 = keyboard.nextInt();

 

System.out.print("Exam 2:

 

");

 

Exam2 = keyboard.nextInt();

 

System.out.print("Final Exam: ");

 

FinalExam = keyboard.nextInt();

 

System.out.print("Labs:

 

");

 

Labs = keyboard.nextInt();

 

System.out.print("Projects:

 

");

 

Projects = keyboard.nextInt();

 

System.out.print("Attendance: ");

 

Attendance = keyboard.nextInt();

 

System.out.print("Quizzes:

 

");

 

Quizzes = keyboard.nextInt();

 

double total = Exam1 +Exam2 +FinalExam +Labs +Projects +Attendance +Quizzes;

 

if(total == 100)

 

{

 

System.out.println("Enter your scores on a scale of 100:");

 

}

 

else if (total>100 || total<100)

 

{

 

System.out.print("Weights don't add up to 100, program

 

exiting...");

 

System.exit(0);

 

} String exam1,exam2,finalexam,labs,projects,attendance,quizzes;

 

exam1 = "Do you know your Exam 1 score?";

 

exam2 = "Do you know your Exam 2 score?";

 

finalexam = "Do you know your Final Exam score?";

 

labs = "Do you know your lab average?";

 

System.out.print("Do you know your exam 1 score?");

 

exam1 = keyboard.next();

 

double exam1g = 0, exam2g = 0, finalexamg = 0, labs1 =

 

0,projects1 = 0,attendance1 = 0,quizzes1 =0;

 

if(exam1.equalsIgnoreCase("y") || (exam1.equalsIgnoreCase("yes"))){

 

System.out.print("Score received on Exam 1:");

 

exam1g = keyboard.nextDouble();

 

System.out.print("Do you know your Exam 2 score?");

 

exam2 = keyboard.next();

 

if (exam2.equalsIgnoreCase("y") ||

 

(exam2.equalsIgnoreCase("yes"))){

 

System.out.print("Score received on Exam 2:");

 

exam2g = keyboard.nextDouble();

 

System.out.print("Do you know your Final Exam grade?"); finalexam = keyboard.next();

 

if (finalexam.equalsIgnoreCase("y") ||

 

(finalexam.equalsIgnoreCase("yes"))){

 

System.out.print("Score received on Final

 

Exam:");

 

finalexamg = keyboard.nextDouble();

 

}

 

}

 

}

 

System.out.print("Do you know your lab average?");

 

labs = keyboard.next();

 

if (labs.equalsIgnoreCase("Y")||(labs.equalsIgnoreCase("yes"))){

 

System.out.print("Average Lab Grade:");

 

labs1 = keyboard.nextDouble();}

 

System.out.print("Do you know your project average?");

 

projects = keyboard.next();

 

if (projects.equalsIgnoreCase("y")||

 

(projects.equalsIgnoreCase("yes"))){

 

System.out.print("Average Project Grade:"); projects1= keyboard.nextDouble();}

 

System.out.print("Do you know your quiz average?");

 

quizzes = keyboard.next();

 

if (quizzes.equalsIgnoreCase("y")||

 

(quizzes.equalsIgnoreCase("yes"))){

 

System.out.print("Average Quiz Grade:");

 

quizzes1=keyboard.nextDouble();

 

System.out.print("Do you know your attendance average?");

 

attendance = keyboard.next();

 

if (attendance.equalsIgnoreCase("y") ||

 

(attendance.equalsIgnoreCase("yes"))){

 

System.out.print("Average Attendance Grade:");

 

attendance1 = keyboard.nextDouble();}

 

int

 

int

 

int

 

int

 

int

 

int

 

int current1

 

current2

 

current3

 

current4

 

current5

 

current6

 

current7 =

 

=

 

=

 

=

 

=

 

=

 

= (int)

 

(int)

 

(int)

 

(int)

 

(int)

 

(int)

 

(int) (Exam1*exam1g);

 

(Exam2*exam2g);

 

(FinalExam*finalexamg);

 

(Labs*labs1);

 

(Projects*projects1);

 

(Quizzes*quizzes1);

 

(Attendance*attendance1); double currentScore = ((current1)+(current2)+(current3)+(current4)+

 

(current5)+(current6)+(current7) / (100 +

 

Exam1+Exam2+FinalExam+Labs+Projects+Quizzes+Attendance));

 

System.out.print("Current Grade Score:"+currentScore);

 

}

 

}

 

/*else

 

System.out.print(labs);

 

keyboard.next();

 

exam1 = null;

 

if(exam2.equalsIgnoreCase("y")||

 

(exam2.equalsIgnoreCase("yes")))

 

{

 

System.out.print("Score received on Exam 2:");

 

keyboard.next();

 

System.out.print(finalexam);

 

finalexam = keyboard.next();

 

}

 

else

 

System.out.print(labs);

 

keyboard.next();

 

if(finalexam.equalsIgnoreCase("y")||

 

(finalexam.equalsIgnoreCase("yes")))

 

{

 

System.out.print("Score received on Exam 3:");

 

keyboard.next();

 

System.out.println(labs);

 

labs = keyboard.next();

 

}

 

else

 

System.out.print(labs); */ private static boolean grade(String string, String string2, String

 

string3, String string4) {

 

// TODO Auto-generated method stub

 

return false;

 

}

 

private static boolean grade(String string, String string2, String

 

string3, String string4, String string5) {

 

// TODO Auto-generated method stub

 

return false;

 

}

 

}

 


Solution details:

Pay using PayPal (No PayPal account Required) or your credit card . All your purchases are securely protected by .
SiteLock

About this Question

STATUS

Answered

QUALITY

Approved

DATE ANSWERED

Sep 13, 2020

EXPERT

Tutor

ANSWER RATING

GET INSTANT HELP/h4>

We have top-notch tutors who can do your essay/homework for you at a reasonable cost and then you can simply use that essay as a template to build your own arguments.

You can also use these solutions:

  • As a reference for in-depth understanding of the subject.
  • As a source of ideas / reasoning for your own research (if properly referenced)
  • For editing and paraphrasing (check your institution's definition of plagiarism and recommended paraphrase).
This we believe is a better way of understanding a problem and makes use of the efficiency of time of the student.

NEW ASSIGNMENT HELP?

Order New Solution. Quick Turnaround

Click on the button below in order to Order for a New, Original and High-Quality Essay Solutions. New orders are original solutions and precise to your writing instruction requirements. Place a New Order using the button below.

WE GUARANTEE, THAT YOUR PAPER WILL BE WRITTEN FROM SCRATCH AND WITHIN A DEADLINE.

Order Now