Question

In: Computer Science

Create a small program that calculates the final grade in this course, given the different assignments...

Create a small program that calculates the final grade in this course, given the different assignments and exams you will be required to take. The program should ask for all the grades through the semester, and as a final output it should compute the weighted average as well as give the final letter grade. You should use the syllabus for this course to calculate the final grade. • Five assignments worth 30 points each. • Three projects worth 100 points each. • Seven quizzes worth 20 points each. • Participation is worth 10 points. Your final grade is calculated out of the total points you earn. For example, if the total possible points are 500 and you have a 461, your grade is 461/500 x 100 = 92% which is an A-. Extra Credit: If you wish to challenge yourself, you can make sure that the program “fails gracefully”. If someone enters the wrong information or data type, prompt the user with a handled message. Although we will deal with error handling later in the semester, thinking about exceptions is always important. Another way to make the program slightly more challenging is to accept an undetermined number of quizzes.

Solutions

Expert Solution

Answer:

Source Code:

package marks;

import java.util.Scanner;

public class Result {
   private double midTerm;
   private double endSem;
   private double quizAvg;
  
public double getMidTerm() {
       return midTerm;
   }

   public void setMidTerm(double midTerm) {
       this.midTerm = midTerm;
   }

   public double getEndSem() {
       return endSem;
   }

   public void setEndSem(double endSem) {
       this.endSem = endSem;
   }

   public double getQuizAvg() {
       return quizAvg;
   }

   public void setQuizAvg(double quizAvg) {
       this.quizAvg = quizAvg;
   }

   public void calculate(double midterm,double endsem, double quizavg) {
   /** a. There are n quizzes, each graded on the basis of 10 points
   * b. There is one mid term and one end semester each graded on the basis of 100 points
   * c. the end semester counts for 50% of the grade, the mid term counts for 25% and the quiz
   * score together counts for a total of 25%
   *
   **/
      
       double midTermPercentage=midterm*0.25;
       double endSemPercentage=endsem*0.5;
       double quizPercentage=quizavg*0.25;
      
       double finalResult=midTermPercentage+endSemPercentage+quizPercentage;
      
       System.out.println("Final Percentage is: "+finalResult);
       System.out.println();
      
       System.out.print("The student Grade is: ");
   if(finalResult>=80)
   {
   System.out.print("A");
   }
   else if(finalResult>=60 && finalResult<80)
   {
   System.out.print("B");
   }
   else if(finalResult>=40 && finalResult<60)
   {
   System.out.print("C");
   }
   else
   {
   System.out.print("D");
   }
             
}

   public static void main(String[] args) {
   int sum=0;
   Scanner sc=new Scanner(System.in);
   Result r=new Result();
      
       System.out.println("Enter The Marks Scored in Mid Term out Of 100");
       double midTerm=sc.nextDouble();
       r.setMidTerm(midTerm);
      
      
       System.out.println("Enter The Marks Scored in end Semester out Of 100");
       double endSem=sc.nextDouble();
       r.setEndSem(endSem);
      
       System.out.println("Enter The no .of Quiz");
       int noOfQuiz=sc.nextInt();
      
       System.out.println("Enter the marks in each quiz out of 10");
      
       double quiz[]=new double[noOfQuiz];
       for(int i=0;i<quiz.length;i++)
       { System.out.println("enter marks for quiz: " +(i+1));
           quiz[i]=sc.nextDouble();
       }
       for(int j=0;j<quiz.length;j++)
       {
           sum+=quiz[j];
       }
      
       double quizAvg=(sum/noOfQuiz)*10;
      
       r.setQuizAvg(quizAvg);
      
       r.calculate(r.getMidTerm(),r.getEndSem(),r.getQuizAvg());  

   }

}

Related Solutions

Create the pseudocode solution to a program that calculates the final score and letter grade for...
Create the pseudocode solution to a program that calculates the final score and letter grade for one student. Please use the following grading system: 9 Homework Assignments – 100 points each 10 points 11 Quizzes – 100 points each 5 points 5 Projects – 100 points each 10 points 6 Discussion posts – 100 points each 10 points 4 Exams – 100 points each 65 points A = 90 – 100% B = 80 – 89% C = 70 –...
Question: How do I write a program in C# that calculates a student's final grade for...
Question: How do I write a program in C# that calculates a student's final grade for a test with 20 multiple questions using arrays and helper methods? Instructions: (0-incorrect answer, 1-correct answer) If the student answered the question right, add .5 points to the running total. If the student didn’t answer correctly subtract .5 points from the running total. The running total is initialized with 5 points (so the student receives 5 points extra credit). To define the final grade...
ITP100 Project: Part 3 Create the pseudocode solution to a program that calculates the final score...
ITP100 Project: Part 3 Create the pseudocode solution to a program that calculates the final score and letter grade for one student. Please use the following grading system: 9 Homework Assignments – 100 points each 10 points 11 Quizzes – 100 points each 5 points 5 Projects – 100 points each 10 points 6 Discussion posts – 100 points each 10 points 4 Exams – 100 points each 65 points A = 90 – 100% B = 80 – 89%...
ITP100 Project: Part 3 Create the pseudocode solution to a program that calculates the final score...
ITP100 Project: Part 3 Create the pseudocode solution to a program that calculates the final score and letter grade for one student. Please use the following grading system: 9 Homework Assignments – 100 points each 10 points 11 Quizzes – 100 points each 5 points 5 Projects – 100 points each 10 points 6 Discussion posts – 100 points each 10 points 4 Exams – 100 points each 65 points A = 90 – 100% B = 80 – 89%...
Modify the provided code to create a program that calculates the amount of change given to...
Modify the provided code to create a program that calculates the amount of change given to a customer based on their total. The program prompts the user to enter an item choice, quantity, and payment amount. Use three functions: • bool isValidChoice(char) – Takes the user choice as an argument, and returns true if it is a valid selection. Otherwise it returns false. • float calcTotal(int, float) – Takes the item cost and the quantity as arguments. Calculates the subtotal,...
In C Program #include Create a C program that calculates the gross and net pay given...
In C Program #include Create a C program that calculates the gross and net pay given a user-specified number of hours worked, at minimum wage. The program should compile without any errors or warnings (e.g., syntax errors) The program should not contain logical errors such as subtracting values when you meant to add (e.g., logical errors) The program should not crash when running (e.g., runtime errors) When you run the program, the output should look like this: Hours per Week:...
Throughout this course, you will complete assignments that lead up to a final project. The project,...
Throughout this course, you will complete assignments that lead up to a final project. The project, titled “Consultant to the Client Organization,” is based on a scenario presented below. It may be helpful to refer back to this scenario as you complete each assignment. Consultant to the Client Organization Fig Technologies is a global technology solutions firm with offices around the globe. Fig Technologies’ corporate headquarters is just outside Mobile, Alabama. Fig recently acquired several smaller firms in different regions...
Develop a program that calculates the final score and the average score for a student from...
Develop a program that calculates the final score and the average score for a student from his/her (1)class participation, (2) test, (3) assignment, (4) exam, and (5) practice scores. The user should enter the name of the student and scores ranging from 0 to 100 for each grading item. The final score is the sum of all grading items. The average score is the average of all grading items. Here is a sample output of the program: Enter the Student's...
Write a C program that calculates a student grade in the C Programming Class. Ask the...
Write a C program that calculates a student grade in the C Programming Class. Ask the user to enter the grades for each one of the assignments completed in class: Quiz #1 - 25 points Quiz #2 - 50 points Quiz #3 - 30 points Project #1 - 100 points Project #2 - 100 points Final Test - 100 points The total of the quizzes count for a 30% of the total grade, the total of the projects counts for...
Write a C program that calculates the average grade for a specified number of students from...
Write a C program that calculates the average grade for a specified number of students from each student's test1 and test2 grades. The program must first ask the user how many students there are. Then, for each student, the program will ask the user for the test1 grade (grade #1) and test2 grade (grade #2). The program should be able to handle up to 100 students, each with 2 grades (test1 and test2). Use a two-dimensional float array to store...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT