Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please use Java to program Your program will read from an input file: courseData.txt . Note that when you click on the link to this
please use Java to program
Your program will read from an input file: courseData.txt . Note that when you click on the link to this file, Canvas will automatically put it into a window in the Canvas environment. You'll need to select the data and copy it to an open text file (such as open with NotePad or Word) and save it as plain text. Do not save it as Rich Text Format (rtf) or a Word format (.doc or doc x ). The above input file has a number of data items stored in the file in the following order: 1. Global data is on the first line, as this applies to all classes. This first line holds the weights to use for all classes, in this order: program weight, midterm weight, and final exam weight. 2. Every other line in the file is specific to a class, and so the next line starts with a course identifier (161, 162, or 263 , and this is an int). 3. After the course identifier, a set of lines belonging to that course are listed, each with a student ID (four digits, such as 1234), an unweighted program score, an unweighted midterm score, and an unweighted final score. You may assume that each course in the file has at least one student. 4. Reaching a 0 indicates the end of input for a specific class, or the end of file if all class data has been consumed. Note that the courseData.txt file terminates with a newline character after the final zero. This means that will test true even after that final zero is read. Given this data file, your program should: Note that the courseData.txt file terminates with a newline character after the final zero. This means that will test true even after that final zero is read. Given this data file, your program should: 1. Be well-documented with comments! I've included a number of comments in the sample code below as examples. This is the first assignment where you'll be graded on both correctness and code quality, with respect to comments. (Read the grading rubric for a list of everything you'll be graded on!) 2. Read in weights, IDs, course numbers, programs scores, midterm scores, and final scores per student from the sample input file provided (using or 3. Calculate statistics per student and per class and report the following: a. Output a weighted average per student. b. Output a Pass/Fail mark per student. c. Output an average per class. 4. Your output should be compared against the sample output below for accuracy. 5. There should be at least one method that you write that can be used to provide output for tracing variables: a. The method should be called -something, e.g., b. Somewhere in your program, there should be a call to that method. In the code you submit, that call should be commented out, but I should be able to find it. Your assignment is to write a class averaging program that outputs a summary of classes and students, given the above input data. For a high-level view, a sample program execution below is given, with some of the output replaced by ellipses. (The report goes to the console. If this assignment is too easy, for an added challenge, have the report be written in a GUI using JOptionPane.) YOUR PROGRAM'S OUTPUT MUST LOOK LIKE THIS SAMPLE. Minor deviations are permitted, such as the number of spaces between columns, but for the most part, it should look like the sample: Grade Data For Class 162 Grode Data for Class 263 10 Programs Midterm Final Weighted Average Programs grade e is a skeleton code you could use as a starting point for your project: port java. util. Scanner; port java. io. FileInputStream; port java. io. ToException; Authors: Fukuda, Zander (edited by Nash, minor edits by Lin) blic class Possibleskeleton /1... class constants go here ... public static void main(String ] args) \{ int courseNumber; / Number of the course Scanner inputFile = null; // File containing data (p. 297 11 in Savitch discusses nutl) I/ ... code assigning inputFile in a try/catch statement II... code for any stuff you need to do one time ... //Per class, print a table of ID numbers, grades, weighted average II per student, and a Pass or Fail programs grade. The class average is also printed. for (...) f I/ Read class number, print class number title, headings. courseNumber - inputFile, nextintO; ... rest of the code goes here ... I/ initialization ... code goes here ... 1/ Loop to handle one class: 1f For each student in the class, get and print their If information, compute their avg, and sum the avgs. while (...) t 3... code goes here ... public static void main(Stringl] args) \{ int courseNumber; 1/ Number of the course Scanner inputFile = null; /1 File containing data ( P .297 1/ in Savitch discusses null) 11... code assigning inputFile in a try/catch statement /I .... code for any stuff you need to do one time ... //Per class, print a table of ID numbers, grades, weighted average 1/ per student, and a Pass or Fail programs grade. The class If average is also printed. for () \{ I/ Read class number, print class number title, headings. courseNumber = inputFile. nextInt(); ... rest of the code goes here ... /I initialization ... code goes here... I/ Loop to handle one class: 1/ For each student in the class, get and print their II information, compute their avg, and sum the avgs. while () f \}... code goes here ... If compute and print class average 3 \}... code goes here ... Feel free to use something different. There are any number of solutions and this skeleton is merely one possible acceptable structure for this assignment. However, make sure whatever solution you use satisfies the possible grading criteria. (For instance, in the above skeleton method calls are left for you to fill in; this does not mean that your program should be one big main method with no other methods.) Most of the criteria listed on the rubric are self-explanatory. The Programming Style 1-3 criterion will be selected by the instructor from these criteria: - Comments describe purpose and conditions for each method: These are done as Javadoc comments that are placed before each method header line. (Look up "Javadoc" in the textbook index if you're not sure what this is.) - Comments document non-obvious code blocks. - Each code file has a header block at the top of the file that describes the purpose and assumptions of the class or program. - Appropriate blank lines are used between code blocks. - Meaningful identifiers are used. - Indentation is used appropriately to delineate code blocks. Thus, if you wish to maximize your chance of recelving full-credit, make sure all of the above programming style criteria are met by your code. courseData.txt 0.30161333344445555016212126666777788889999026322228989909000.3070508090609095759060700.4060509085809087776540805050809290909373756030 File Preview ling virtual machine., Done Your program will read from an input file: courseData.txt . Note that when you click on the link to this file, Canvas will automatically put it into a window in the Canvas environment. You'll need to select the data and copy it to an open text file (such as open with NotePad or Word) and save it as plain text. Do not save it as Rich Text Format (rtf) or a Word format (.doc or doc x ). The above input file has a number of data items stored in the file in the following order: 1. Global data is on the first line, as this applies to all classes. This first line holds the weights to use for all classes, in this order: program weight, midterm weight, and final exam weight. 2. Every other line in the file is specific to a class, and so the next line starts with a course identifier (161, 162, or 263 , and this is an int). 3. After the course identifier, a set of lines belonging to that course are listed, each with a student ID (four digits, such as 1234), an unweighted program score, an unweighted midterm score, and an unweighted final score. You may assume that each course in the file has at least one student. 4. Reaching a 0 indicates the end of input for a specific class, or the end of file if all class data has been consumed. Note that the courseData.txt file terminates with a newline character after the final zero. This means that will test true even after that final zero is read. Given this data file, your program should: Note that the courseData.txt file terminates with a newline character after the final zero. This means that will test true even after that final zero is read. Given this data file, your program should: 1. Be well-documented with comments! I've included a number of comments in the sample code below as examples. This is the first assignment where you'll be graded on both correctness and code quality, with respect to comments. (Read the grading rubric for a list of everything you'll be graded on!) 2. Read in weights, IDs, course numbers, programs scores, midterm scores, and final scores per student from the sample input file provided (using or 3. Calculate statistics per student and per class and report the following: a. Output a weighted average per student. b. Output a Pass/Fail mark per student. c. Output an average per class. 4. Your output should be compared against the sample output below for accuracy. 5. There should be at least one method that you write that can be used to provide output for tracing variables: a. The method should be called -something, e.g., b. Somewhere in your program, there should be a call to that method. In the code you submit, that call should be commented out, but I should be able to find it. Your assignment is to write a class averaging program that outputs a summary of classes and students, given the above input data. For a high-level view, a sample program execution below is given, with some of the output replaced by ellipses. (The report goes to the console. If this assignment is too easy, for an added challenge, have the report be written in a GUI using JOptionPane.) YOUR PROGRAM'S OUTPUT MUST LOOK LIKE THIS SAMPLE. Minor deviations are permitted, such as the number of spaces between columns, but for the most part, it should look like the sample: Grade Data For Class 162 Grode Data for Class 263 10 Programs Midterm Final Weighted Average Programs grade e is a skeleton code you could use as a starting point for your project: port java. util. Scanner; port java. io. FileInputStream; port java. io. ToException; Authors: Fukuda, Zander (edited by Nash, minor edits by Lin) blic class Possibleskeleton /1... class constants go here ... public static void main(String ] args) \{ int courseNumber; / Number of the course Scanner inputFile = null; // File containing data (p. 297 11 in Savitch discusses nutl) I/ ... code assigning inputFile in a try/catch statement II... code for any stuff you need to do one time ... //Per class, print a table of ID numbers, grades, weighted average II per student, and a Pass or Fail programs grade. The class average is also printed. for (...) f I/ Read class number, print class number title, headings. courseNumber - inputFile, nextintO; ... rest of the code goes here ... I/ initialization ... code goes here ... 1/ Loop to handle one class: 1f For each student in the class, get and print their If information, compute their avg, and sum the avgs. while (...) t 3... code goes here ... public static void main(Stringl] args) \{ int courseNumber; 1/ Number of the course Scanner inputFile = null; /1 File containing data ( P .297 1/ in Savitch discusses null) 11... code assigning inputFile in a try/catch statement /I .... code for any stuff you need to do one time ... //Per class, print a table of ID numbers, grades, weighted average 1/ per student, and a Pass or Fail programs grade. The class If average is also printed. for () \{ I/ Read class number, print class number title, headings. courseNumber = inputFile. nextInt(); ... rest of the code goes here ... /I initialization ... code goes here... I/ Loop to handle one class: 1/ For each student in the class, get and print their II information, compute their avg, and sum the avgs. while () f \}... code goes here ... If compute and print class average 3 \}... code goes here ... Feel free to use something different. There are any number of solutions and this skeleton is merely one possible acceptable structure for this assignment. However, make sure whatever solution you use satisfies the possible grading criteria. (For instance, in the above skeleton method calls are left for you to fill in; this does not mean that your program should be one big main method with no other methods.) Most of the criteria listed on the rubric are self-explanatory. The Programming Style 1-3 criterion will be selected by the instructor from these criteria: - Comments describe purpose and conditions for each method: These are done as Javadoc comments that are placed before each method header line. (Look up "Javadoc" in the textbook index if you're not sure what this is.) - Comments document non-obvious code blocks. - Each code file has a header block at the top of the file that describes the purpose and assumptions of the class or program. - Appropriate blank lines are used between code blocks. - Meaningful identifiers are used. - Indentation is used appropriately to delineate code blocks. Thus, if you wish to maximize your chance of recelving full-credit, make sure all of the above programming style criteria are met by your code. courseData.txt 0.30161333344445555016212126666777788889999026322228989909000.3070508090609095759060700.4060509085809087776540805050809290909373756030 File Preview ling virtual machine., Done 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