Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Java Write a grading program for a class with the following grading policies: 1. There are two quizzes, each graded on the basis of

Using Java

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

image text in transcribed

Write a grading program for a class with the following grading policies: 1. There are two quizzes, each graded on the basis of 10 points. 2. There is one midterm exam and one final exam, each graded on the basis of 100 points. 3. The final exam counts for 50% of the grade, the midterm counts for 25%, and two quizzes each count for 12.5%. (Do not forget to normalize the quiz scores. They should be converted to a percent before they are averaged in.) Any grades of 90 or more is an A, any grades of 80 or more (but less than 90) is a B, any grades of 70 or more (but less than 80) is a C, any grades of 60 or more (but less than 70) is a D, and any grades below 60 is an F. The program will read in students' scores from an input file named input.txt and output the students' records to a file amed "output.txt", which consist of student's ID, name, two quizzes and two exam scores as well as the students' average score for the course and final letter grade. Define and use a class for a student record. Note: input/output should be done with files. The organization for the input file is as follows: The number at the top represents the number of students in a class. Following are students' records, which consist of 6 items: student ID . name quiz 1 quiz 2 midterm exam final exam "input.txt" input - Notepad File Edit Format View Help 10 0001 bucky 10 10 70 90 0002 joe 79 90 100 0003 mike 8 8 75 70 0004 nick 10 7 90 80 0005 jenn 99 100 95 0006 elsa 8 9 70 85 0007 jack 9 10 85 74 0008 will 5 7 75 60 0009 seth 9 7 90 85 0010 rose 5 5 65 60 After running your program, the system should generate a file named output.txt which looks like X Grade A C output - Notepad File Edit Format View Help ID Name Quiz1 0001 bucky 10 0002 joe 7 0003 mike 8 0004 nick 10 0005 jenn 9 0006 elsa 8 0007 jack 9 0008 will 5 0009 seth 9 0010 rose 5 B Quiz2 10 9 8 7 9 9 10 7 7 5 000 in in Midterm Final 70 90 90 100 75 70 90 80 100 95 70 85 85 74 75 60 90 85 65 60 Avg. 87.5 92.5 73.75 83.75 95.0 81.25 82.0 63.75 85.0 58.75 B B D B F public class Student{ private String student ID; private String name; private int quiz1; private int quiz2; private int midterm; private int finalexam; private double avg; private String grade; B 3 - public Student () // TODO initialize all the private data members (id="na", n="na", quiz1=8, quiz2=0, // midterm=6, finalexam=0, avg=0.0, grade="na") // Here is an example this("na", "na", 0, 0, 0, 0, 0.0, "na"); 1 public public Student (String id, String n, int 01, int 92, int m, int f) // TODO initialize all the private data members with the given arguments, while the grade is "na" // Here is an example this(id, n, 91, 92, m, f, 0.0, "na"); } public Student (String id, String n, int qi, int 92, int m, int f, double a, String letterGrade) // TODO initialize all the private data members with the given arguments public // Here is an example studentID=id; name=n; quiz1=1; quiz2=42; midterm=m; finalexam=f; avg=a; grade=letterGrade; } public void set(String id, String n, int 91, int q2, int m, int f, double a, String g) // TODO set all the private data members with the given arguments } public void calcAvg() { // TODO Calculate the average grade (avg) based on the student's scores (quizi, quiz2, midterm and finalexam } public void calcGrade() // TODO Calculate the letter grade (A, B, C, D and F) based on the student's average grade (avg) 2 } - public String getId() // TODO return student ID // Here is an example return studentID; } public public String getName() // TODO return name return "na"; } public int getQuiz10) // TODO return quizi return; } public public int getQuiz2() // TODO return quiz2 return 0; } public int getMidterm() // TODO return midterm return; } public int getFinalexam) public // TODO return finalexam return; public double getAvg() public // TODO calculate the average grade and return the calculated value (avg) return 0.0; } public String getGrade) // TODO calculate the letter grade and return the calculated value (grade) return "na"; } 2 import java.io.*; import java.util.*; public class ReadWriteFile{ private Scanner x; private int numberOfStudents; private Student[] myclass =new Student [20]; public void openFile() { try { 10 10 110 11 12 12 13 12 14 15 16 19 17 1 18 10 19 20 21 x=new Scanner(new File("input.txt")); } catch (Exception e) { System.out.println("Could not find file!"); } } 220 // Read data from a file public void readFile() { numberOfStudents=x.nextInt(); 23 2 24 25 26 27 2 28 29 for (int i=0; i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Marketing The Ultimate Marketing Tool

Authors: Edward L. Nash

1st Edition

0070460639, 978-0070460638

More Books

Students also viewed these Databases questions

Question

What is the basis for Security Concerns in Cloud Computing?

Answered: 1 week ago

Question

Describe the three main Cloud Computing Environments.

Answered: 1 week ago