Question

Write a grading program in Java for a class with the following grading policies: There are...

Write a grading program in Java for a class with the following grading policies: There are three quizzes, each graded on the basis of 10 points. There is one midterm exam, graded on the basis of 100 points. There is one final exam, graded on the basis of 100 points. The final exam counts for 40% of the grade. The midterm counts for 35% of the grade. The three quizzes together count for a total of 25% of the grade. (Do not forget to convert the quiz scores to percentages before they are averaged in.) Any grade of 90 or more is an A, any grade of 80 or more (but less than 90) is a B, any grade of 70 or more (but less than 80) is a C, any grade of 60 or more (but less than 70) is a D, and any grade below 60 is an F. The program should read in the student’s scores and output the student’s record, which consists of three quiz scores and two exam scores, as well as the student’s overall numeric score for the entire course and final letter grade. Define and use a class for the student record. The class should have instance variables for the quizzes, midterm, final, overall numeric score for the course, and final letter grade. The overall numeric score is a number in the range 0 to 100, which represents the weighted average of the student’s work. The class should have methods to compute the overall numeric grade and the final letter grade. These last methods should be void methods that set the appropriate instance variables. Your class should have a reasonable set of accessor and mutator methods, an equals method, and a toString method, whether or not your program uses them. You may add other methods if you wish.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

// StudentRecords.java

import java.util.Scanner;
class StudentRecords {
   float quiz1,quiz2,quiz3,midterm,finalexam;
   //calculating quiz percent for 25%
   float quizPercent(float quiz1,float quiz2,float quiz3){
       this.quiz1=quiz1;
       this.quiz2=quiz2;
       this.quiz3=quiz3;
       float quizPer = (quiz1*10+quiz2*10+quiz3*10)/3;
       float quizavg = (quizPer/100)*25;
       return quizavg;
   }
   //claculating mid term percent for 35%
   float midtermPercent(float midterm){
       this.midterm = midterm;
       float midtermAvg = (midterm/100)*35;
       return midtermAvg;
   }
   //calculating final exam percent for 40%
   float finalexamPercent(float finalexam){
       this.finalexam = finalexam;
       float finalexamavg = (finalexam/100)*40;
       return finalexamavg;
      
   }
   //calculating overall numeric grade
   float overallNumericScore(float quiz,float mid,float Final){
       float numericGrade = (quiz+mid+Final);
       return numericGrade;
   }
   //calculaing final letter grade
   String letterGradeScore(float numericGrade){
       if(numericGrade>=90 && numericGrade<=100)
           return "A";
       else if(numericGrade>=80 && numericGrade<90)
           return "B";
       else if(numericGrade>=70 && numericGrade<80)
           return "C";
       else if(numericGrade>=60 && numericGrade<70)
           return "D";
       else if(numericGrade>=0 && numericGrade<60)
           return "F";
       else
           return null;
   }

   public static void main(String[] args) {
       Scanner read = new Scanner(System.in);   //for reading input from user
       float quiz1,quiz2,quiz3,midterm,finalexam;
       //taking marks points from user
       System.out.print("Enter quiz 1 points : ");
       quiz1 = read.nextInt();
       System.out.print("Enter quiz 2 points : ");
       quiz2 = read.nextInt();
       System.out.print("Enter quiz 3 points : ");
       quiz3 = read.nextInt();
       System.out.print("Enter mid term points : ");
       midterm = read.nextInt();
       System.out.print("Enter final exam points : ");
       finalexam = read.nextInt();
       //object creation
       StudentRecords obj = new StudentRecords();
       float quiz = obj. quizPercent(quiz1,quiz2,quiz3);
       float mid = obj.midtermPercent(midterm);
       float Final = obj.finalexamPercent(finalexam);
       float numericGarde=obj.overallNumericScore(quiz,mid,Final);
       String letterGrade =obj.letterGradeScore(numericGarde);
       //displaying results
       System.out.println("numeric Grade : " + (int)numericGarde );
       System.out.println("Letter Grade : " + letterGrade );
   }
}

Add a comment
Know the answer?
Add Answer to:
Write a grading program in Java for a class with the following grading policies: There are...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • using if/switch statements (C++) Write a grading program for a class with the following grading policies:...

    using if/switch statements (C++) Write a grading program for a class with the following grading policies: There are two quizzes, each graded on the basis of 10 points There is one midterm exam and one final exam, each graded on the basis of 100 points The final exam counts for 50% of the grade, the midterm counts for 25% and the two quizzes together count for a total of 25%. (Do not forget to normalize the quiz scores. They should...

  • Write a grading program for the following grading policies:- a. There are two quizzes, each graded...

    Write a grading program for the following grading policies:- a. There are two quizzes, each graded on the basis of 10 points. b. There is one midterm exam and one final exam, each graded on the basis of 100 points. c. The final exam counts for 50 percent of the grade, the midterm counts for 25 percent and the two quizzes together count for a total of 25 percent. Grading system is as follows:- >90 A >=80 and <90 B...

  • In C Langage Write a grading program for a class with the following grading policies:- a. There are two quizzes, each gr...

    In C Langage Write a grading program for a class with the following grading policies:- a. There are two quizzes, each graded on the basis of 10 points. b. There is one midterm exam and one final exam, each graded on the basis of 100 points. c. The final exam counts for 50 percent of the grade, the midterm counts for 25 percent and the two quizzes together count for a total of 25 percent. Grading system is as follows:-...

  • C++ Write a program to calculate final grade in this class, for the scores given below...

    C++ Write a program to calculate final grade in this class, for the scores given below . Remember to exclude one lowest quiz score out of the 4 while initializing the array. Display final numeric score and letter grade. Use standard include <iostream> Implementation: Use arrays for quizzes, labs, projects and exams. Follow Sample Output for formatting. May use initialization lists for arrays. Weight distribution is as follows: Labs: 15% Projects: 20% Quizzes: 20% Exams: 25% Final Project: 20% Display...

  • Write a program to calculate your final grade in this class. Three(8) assignments have yet to...

    Write a program to calculate your final grade in this class. Three(8) assignments have yet to be graded: Quiz 7, Lab 7 and Final Project. Assume ungraded items receive a grade of 100 points. Remember to drop the lowest two quiz scores. Display final numeric score and letter grade. Implementation: Weight distribution is listed in canvas. Use arrays for quizzes, labs, projects and exams. You are allowed to use initialization lists for arrays. Use at least three (3) programmer defined...

  • Java Program: In this project, you will write a program called GradeCalculator that will calculate the...

    Java Program: In this project, you will write a program called GradeCalculator that will calculate the grading statistics of a desired number of students. Your program should start out by prompting the user to enter the number of students in the classroom and the number of exam scores. Your program then prompts for each student’s name and the scores for each exam. The exam scores should be entered as a sequence of numbers separated by blank space. Your program will...

  • c++ implement a student class Determine the final scores, letter grades, and rankings of all students...

    c++ implement a student class Determine the final scores, letter grades, and rankings of all students in a course. All records of the course will be stored in an input file, and a record of each student will include the first name, id, five quiz scores, two exam scores, and one final exam score. For this project, you will develop a program named cpp to determine the final scores, letter grades, and rankings of all students in a course. All...

  • Language: C++ Write a program that will allow the instructor to enter the student's names, student...

    Language: C++ Write a program that will allow the instructor to enter the student's names, student ID, and their scores on the various exams and projects. A class has a number of students during a semester. Those students take 4 quizzes, one midterm, and one final project. All quizzes weights add up to 40% of the overall grade. The midterm exam is 25% while the final project 35%. The program will issue a report. The report will show individual grades...

  • In Java, write a class Grade with following member variables and method: int midtermExam, int finalExam:...

    In Java, write a class Grade with following member variables and method: int midtermExam, int finalExam: represent the scores of midterm and final exams respectively. The maximum score for each exam is 100. double getOverallScore(): returns the overall score calculated as follows: 40% midterm and 60% final. Write another class Grade180 that is a subclass of Grade and has the following member variables and method: int midtermExam, int finalExam: inherited from Grade super class. int hw1, int hw2, int project1,...

  • Grading Policy In addition to three in-class tests and a final exam, the final grade will...

    Grading Policy In addition to three in-class tests and a final exam, the final grade will include assessment of homework, quiz projects/classroom activities, and classroom participation, according to the following weights 1. Homework and Worksheets 2. Three Tests 3. Final Exam 4. Quizzes and Class Participation/Classroom Citizenshi 1 5% 40% 25% 20% Total 100% Grad Ran 92 100 90-91 88-89 82-87 80-81 an 78 -79 70-77 68 -69 66 67 60- 65 Assignment Grading: Each written assignment, except the Final...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT