Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Teacherinfo.java For this assignment, you will read information from a text file, then write to another text file and the terminal window. The number of
Teacherinfo.java For this assignment, you will read information from a text file, then write to another text file and the terminal window. The number of A's, B's, etc will be determined. We will use the standard grading scale. Scores of 90 and above will be counted as an 'A', those from 80 to 90 (not including 90) will be counted as a 'B', those from 70 to 80 (not including 80) will be counted as a 'C', those from 60 to 70 (not including 70) will be counted as a 'D', and the remaining scores will be considered as an 'F'. Write a program that will read test scores from a text file that contains information about the class and teacher, then separate out the grade data that is stored in this file and print it various ways. Program 1. Inside the FileIO directory, save the files TeacherInfo.java and the text files t1.txt and t2.txt. 2. Not counting the fields for Filelo, you will have three fields (i.e. field variables), which will be arrays. Two will be int arrays. One array will be scores, which will be size 101. The other will be grades (A, B, C, D, F) will be size 5. The third will be a String array teacherData, which will be size 3 for the teacher name, the course name and the course number. 3. After prompting the user for the input file name, the output file name will be created. Remove the .txt" from the input file name, then concatenate"-results.txt" to make the output file name. For example, if the user types in t1.txt for the input file name, the output file name will be t1-results.txt. 4. The program will read in the file to get the appropriate information. From the file, find and store the teacher's name in teacherData[0], the course name in teacherData[1], and the course number teacherData[2] 5. To read in the test scores, you can use the Scanner method hasNextDouble. After reading in a number from the file, make the number an int (truncate it, do not round). The array scores is used to store the number of times that score (after it was made an int) occurred. For example, if the score is 99 (after truncating), then scores[99] is incremented by 1. 6. When reading the file, find the number of times the course is listed in the file. That value will need to be returned. (Remember, you only have the fields stated above.) 7. Determine the total number of scores for the course that the user typed in. 8. After all of the scores have been read in and stored into scores, find the number of A's, B's, C's, etc and store them into grades. The element at grades[0] will be the number of A's, the element at grades[1] will be the number of B's, etc. Printing - see the sample runs. The heading for each are given in the sample runs. 9. Print the teacher and class information shown in the sample run to both the terminal window and the file. 10. Print the scores, in order, 15 to a line, right justified in a field width of 5, to just the terminal window. 11. Print all of the scores from 90-100 on one line, then 80 - 89 on the next line, then continue until 10 - 19 on the second to last line, and 0-9 on the last line. If there are no scores for that group, the line is blank. Print these to the text file only. Print them left justified in a field width of 5. 12. Print the number and percentage of each grade to both the terminal window and the text file. Teacherinfo.java For this assignment, you will read information from a text file, then write to another text file and the terminal window. The number of A's, B's, etc will be determined. We will use the standard grading scale. Scores of 90 and above will be counted as an 'A', those from 80 to 90 (not including 90) will be counted as a 'B', those from 70 to 80 (not including 80) will be counted as a 'C', those from 60 to 70 (not including 70) will be counted as a 'D', and the remaining scores will be considered as an 'F'. Write a program that will read test scores from a text file that contains information about the class and teacher, then separate out the grade data that is stored in this file and print it various ways. Program 1. Inside the FileIO directory, save the files TeacherInfo.java and the text files t1.txt and t2.txt. 2. Not counting the fields for Filelo, you will have three fields (i.e. field variables), which will be arrays. Two will be int arrays. One array will be scores, which will be size 101. The other will be grades (A, B, C, D, F) will be size 5. The third will be a String array teacherData, which will be size 3 for the teacher name, the course name and the course number. 3. After prompting the user for the input file name, the output file name will be created. Remove the .txt" from the input file name, then concatenate"-results.txt" to make the output file name. For example, if the user types in t1.txt for the input file name, the output file name will be t1-results.txt. 4. The program will read in the file to get the appropriate information. From the file, find and store the teacher's name in teacherData[0], the course name in teacherData[1], and the course number teacherData[2] 5. To read in the test scores, you can use the Scanner method hasNextDouble. After reading in a number from the file, make the number an int (truncate it, do not round). The array scores is used to store the number of times that score (after it was made an int) occurred. For example, if the score is 99 (after truncating), then scores[99] is incremented by 1. 6. When reading the file, find the number of times the course is listed in the file. That value will need to be returned. (Remember, you only have the fields stated above.) 7. Determine the total number of scores for the course that the user typed in. 8. After all of the scores have been read in and stored into scores, find the number of A's, B's, C's, etc and store them into grades. The element at grades[0] will be the number of A's, the element at grades[1] will be the number of B's, etc. Printing - see the sample runs. The heading for each are given in the sample runs. 9. Print the teacher and class information shown in the sample run to both the terminal window and the file. 10. Print the scores, in order, 15 to a line, right justified in a field width of 5, to just the terminal window. 11. Print all of the scores from 90-100 on one line, then 80 - 89 on the next line, then continue until 10 - 19 on the second to last line, and 0-9 on the last line. If there are no scores for that group, the line is blank. Print these to the text file only. Print them left justified in a field width of 5. 12. Print the number and percentage of each grade to both the terminal window and the text file
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started