<p>A. Two quizzes, each graded on the basis of 10 points.<br />B. One midterm an
ID: 3625696 • Letter: #
Question
<p>A. Two quizzes, each graded on the basis of 10 points.<br />B. One midterm and one final exam, each grade on the basis of 100 points.<br />c. The final exam counts for 50 percent of the grade, the midterm counts for 25 percent, and the two quizzes together counts for a total of 25 percent.(Normalize the quiz scores. They should be converted to percentages before they are averaged)<br /><br />Any grade of 90 percent or more is an A, 80 - 90% = B , 70 - 79% = C, 60 - 69% = D, below 60 - F.<br /><br />Define and use a class for the student record. The classes should have the instance variables for the quiz scores, midterm, final, total score for the course, and final letter grade. The class should have input and output methods. The input method should not ask for the final numeric grade, nor should it ask for the final letter grade. The class should have the method to compute the overall numeric grade and the final letter grade. These last two methods will be void methods that set the appropriate instance variables. remember, one method can call another method. If you prefer, you can define a single method that sets both the overall numeric score and the final letter grade, but if you do this, use a helping method. Your program should use all the methods described here. Your class should have accessor and mutator methods.</p>Explanation / Answer
please rate - thanks
import java.util.Scanner;
class Student
{private String name;
private int q1,q2,mt,fexam;
private char grade;
private double ts;
public Student()
{
}
public void readInput()
{
q1=grades("Quiz1",10);
q2=grades("Quiz 2",10);
mt=grades("Midterm",100);
fexam=grades("Final Exam",100);
}
public void calculateGrade()
{
ts=fexam*.5+mt*.25+(q1+q2)/20.*100.*.25;
grade=getgrade(ts);
}
public void writeOutput()
{
System.out.println(" Grades");
System.out.println("Quiz 1 " + q1);
System.out.println("Quiz 2 " + q2);
System.out.println("Midterm " + mt);
System.out.println("Final Exam " + fexam);
System.out.println("Total Score " + ts);
System.out.println("Final Grade " + grade);
}
public int grades(String name,int max)
{int grade;
Scanner in = new Scanner(System.in);
System.out.print("Enter "+name+" grade ");
grade=in.nextInt();
while(grade<0||grade>max)
{System.out.println("must be between 0 and "+max);
System.out.print("Enter "+name+" grade ");
grade=in.nextInt();
}
return grade;
}
public char getgrade(double g)
{if(g>=90)
return 'A';
if(g>=80)
return 'B';
if(g>=70)
return 'C';
if(g>=60)
return 'D';
return 'F';
}
}
--------------------------------------------------------
import java.util.Scanner;
public class StudentDemo{
public static void main(String[] args)
{int i;
Scanner scan = new Scanner(System.in);
Student person = new Student ();
// one Studentint numberOfStudents, i;
System.out.println("Enter number of Students:");
int numberOfStudents = scan.nextInt( );
for(i = 0; i < numberOfStudents; i++){person.readInput();
person.calculateGrade();
person.writeOutput();
}}}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.