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 –...
Write a program that calculates the student's final grade for a test with 20 multiple questions...
Write a program that calculates the student's final grade for a test with 20 multiple questions using C# .net Framework. se an array of integers to store the test scores (0-incorrect answer, 1-correct answer). Initialize it as follows: int [] scores = {1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 1}; 3. If the student answered the question right, add 5 points to the running total. If the student...
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...
Flooring Quote Calculator Create a program that calculates a price quote for installing different types of...
Flooring Quote Calculator Create a program that calculates a price quote for installing different types of flooring in a house. Allows the user to enter the homeowner’s information, number of rooms where they want new flooring installed, the area of each room, and the type of flooring for each room. Your program will then calculate and print the installation costs. Need to use a House class that contains information about the home and home owner. An inner class, Room, will...
Write a C++ program named, myGrade.cpp, that calculates a letter grade for a student of this...
Write a C++ program named, myGrade.cpp, that calculates a letter grade for a student of this course (CSC100 online) based on three user inputs. This program should begin by printing the title of the application (program) and a brief description of what it does. (Note: this is NOT the same as the program prolog: a prolog is much more detailed, has required elements, and is intended for other programmers reading the cpp file. The title and description displayed by the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT