Question: Part 1: For Lab 6 we are going to implement a small class record keeping system that reads in grades from a file, calculates some

Part 1:

For Lab 6 we are going to implement a small class record keeping system that reads in grades from a file, calculates some intermediate and final grades and averages, prints these out to the screen and a file, calculates a class average and other data and writes that out to the screen and the file as well.

The input file contains multiple grades for multiple students. The format of the input will be given below. Each line will have the same format. Each line will represent the grades for a different student. Initially, there will be a maximum of 12 students data in the file (although this will change in later questions). You will be given an input file of data to use but you will need to create additional data using the same format later in this assignment.

The format of one line of input data is a list of strings, doubles, and ints in the following order:

One_word_String double double double double double double double double double double double int String

Last_Name T1 T2 Final HW1 HW2 HW3 HW4 HW5 HW6 Q1 Q2 HW_count First_Name

Test grades are the double values T1, T2, and Final

Homework grades are HW1, HW2, HW3, HW4, HW5, and HW6

Quiz grades are Q1 and Q2

HW_count is the number of homework assignments submitted. A homework that is not submitted gets a grade of 0 (zero) but a homework that is submitted but is incorrect can also get a grade of 0. The HW_count value tells the number of submitted homework assignments even if some received a grade of 0.

Last_Name, First_Name are the students names. Last_Name is a one word string.

Use the data in the input file grades1.txt unless directed differently by a problem.

1.a) Write an algorithm to calculate a grade for a class given the following requirements:

There are three tests;

Test 1 has a maximum of 100 points and is worth 10% of the grade

Test 2 has a maximum of 100 points and is worth 15% of the grade

Final has a maximum of 200 points and is worth 25% of the grade

There are six homework assignments;

Each assignment has a maximum of 50 points

The highest four assignment grades are used and each is worth 12% of the grade

All six homework assignments must be submitted;

if one assignment is missing, then the 4 highest assignments are each worth 11.5%

if two are missing, then the 4 highest assignments are each worth 10%

if three or more are missing, then the 4 highest assignments are each worth 7.5%

There are two quizzes

Each quiz has a maximum of 10 points and each is worth 1% of the grade

Print the final grade.

1.b) Write a program using Java in NetBeans to implement your algorithm from 1.a) Call your program Lab6Part1b.java. In your program use only individual variables to work with the data. Do you not use arrays. For each line of input from the file, print a line of output that gives all of the students grades, then a second line that gives the students last name, a comma, then the first name, then a colon, then the final grade for the student as calculated by the algorithm. After all the grades are calculated, print the class average, the high grade in the class, the low grade in the class, and the median value for the class grades. Use the variable names below for the data from the file. You must declare each variable of the correct type as described above.

lastName t1 t2 final hw1 hw2 hw3 hw4 hw5 hw6 q1 q2 hwCount firstName

1.c) For this question, create a new program called Lab6Part1c.java. Copy the code from Part1b into this new program. In this program, then, well use two arrays, one array for the doubles and the int (put it in the double array) and a second array for the strings for the names. Call the doubles array grades and the String array names. Replace all the individual variables for grades and names with these two arrays and remove the individual variables from the program. Make sure to print each line of input from the arrays like you did before with the variables.

1.d) Create a new program Lab6Part1d.java and copy the Part1c file into it. In this version, create two two-dimensional arrays to hold the grades for all the students and all the names of all the students. Replace the single dimension arrays with the 2-D arrays.

1.e) What errors could occur if the data in the input file was not formatted correctly?

1.f) Now create a new program Lab6Part1f.java and copy the Part1d file into it. Create an output file called gradesOut.txt. For part e we are going to sort the two dimensional arrays in order by last name. Use a bubble sort algorithm that you write to do the sorting. Print the arrays in their original order to the screen and to the output file, then sort them and print them in order by last name to the screen and to the output file. Make sure to label the output you are creating so that someone can look at your output file and understand what the data represents.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!