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 –...
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%...
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:...
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,...
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...
1. You are interested in predicting the final grade of students in a business course. You...
1. You are interested in predicting the final grade of students in a business course. You collect data on the number of hours studied and final grade for 8 students. Using the data provided below, find the predicted linear regression equation. Copy the data below into an excel spreadsheet, (or you can to this long hand on notebook paper).  You must show all of your calculations. Take calculations out to the 4th decimal place. Do not round up or round down....
Create a program in java that calculates area and perimeter of a square - use a...
Create a program in java that calculates area and perimeter of a square - use a class and test program to calculate the area and perimeter; assume length of square is 7 ft.
In java. Prefer Bluej Create a program in java that calculates area and perimeter of a...
In java. Prefer Bluej Create a program in java that calculates area and perimeter of a square - use a class and test program to calculate the area and perimeter; assume length of square is 7 ft.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT