When submitting this lab, submit a .java file called FormLetter, and create the following structure in Eclipse: Package Name: week13 Class Name: FormLetter Write a program that will read a CSV file containing scores for student assignments, and create a letter saved to a file for each student who has one or more scores of 0, and then print out messages to the console indicating which students have letters written (as show in the example run). In this program you will combine data from the CSV file and the TXT file to create a letter to each student in the class who is missing one or more assignments. The letter must have the following format: , Each letter file must be saved with the following naming format: Warning letter to student - .txt Downloads For this lab you will need to download the file Student Assignment Scores.csv. This file contains a list of students and the scores they received for 6 class assignments. Place this file in your PROJECT directory. You will also need to download the file Warning Letter to Students -.txt. This file contains the body of a form letter to students who are missing assignments. Place this file in your PROJECT directory. Steps Use techniques acquired in previous labs to create two Scanner objects. One Scanner will point to the "Student Assignment Grades.csv" file One Scanner will point to the "Warning Letter to Student - .txt" file Read the full text of the "Warning Letter to Student - .txt" file and store it in a String variable. Read in the text from the "Student Assignment Grades.csv" file, one line at a time and store it in an array using split() For each student: Use methods you have learned in other labs to determine if a student has any assignments with a grade of "0" If a student has at least 1 grade of "0": Use PrintWriter to create a new text file for them (or any other method of file creation you prefer). Make sure the name of the file is in the format described above. Print the first line of the file using text and the student's name as shown in the Example Run. Print the rest of the letter. Remember it is already stored in a single string. Use a for loop to evaluate each grade for the student. If the grade is "0", print text to the file indicating the Assignment number as shown in the Example Run. Close the PrintWriter. Reading an entire file into a String Variable The Scanner has several different methods you are not fully familiar with. .next() - The .next() method retrieves the next 'token' from the scanner input. But what is a token? A token is the next segment of text that comes from the Scanner before the next delimiter. But what is a delimiter? A delimiter is a String or pattern what defines how tokens are broken up in an input stream. By default, a Scanner's delimiter is white space. Therefore, the .next() method will read in all the characters from the input stream until it reaches the next white space where it will stop. .useDelimiter() - The .useDelimiter() method can be used to change the delimiter for the scanner. For example, calling .useDelimiter(",") will change the behavior of .next(). After setting the delimiter to "," the .next() method will read in all characters from the input stream until it reaches the next "," where it will stop. By setting the delimiter to a value you know is not found anywhere in an input file, and then calling .next(), you can successfully read the entire contents of a file into a String variable. Example: Scanner letter = new Scanner(letterFile); //Create a new Scanner object (letter) that points to a File. letter.useDelimiter("\\Z"); //Change the delimiter of the letter Scanner object to "\\Z" since you know that the string "\\Z" is not found anywhere in your .txt file. String letterBody = letter.next(); // .next() will read the entire contents of the file since the delimiter "\\Z" is not found in the .txt file. The String letterBody now contains the entire contents of the file. Example Run Your program output should look like this: Creating letters for: Garrett Wang Ethan Phillips Roxann Dawson Robert Beltran Robert McNeil Armin Shimerman Dominic Keating John Billings Before you run your program, your directory should look like this: Form Letter Creation - Befor.jpg After you run your program, your directory should look like this: Form Letter Creation - After.jpg Opening one of the sample letter files in a document editor should look like this: Letter.jpg

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%
When submitting this lab, submit a .java file called FormLetter, and create the following structure in Eclipse: Package Name: week13 Class Name: FormLetter Write a program that will read a CSV file containing scores for student assignments, and create a letter saved to a file for each student who has one or more scores of 0, and then print out messages to the console indicating which students have letters written (as show in the example run). In this program you will combine data from the CSV file and the TXT file to create a letter to each student in the class who is missing one or more assignments. The letter must have the following format: , Each letter file must be saved with the following naming format: Warning letter to student - .txt Downloads For this lab you will need to download the file Student Assignment Scores.csv. This file contains a list of students and the scores they received for 6 class assignments. Place this file in your PROJECT directory. You will also need to download the file Warning Letter to Students -.txt. This file contains the body of a form letter to students who are missing assignments. Place this file in your PROJECT directory. Steps Use techniques acquired in previous labs to create two Scanner objects. One Scanner will point to the "Student Assignment Grades.csv" file One Scanner will point to the "Warning Letter to Student - .txt" file Read the full text of the "Warning Letter to Student - .txt" file and store it in a String variable. Read in the text from the "Student Assignment Grades.csv" file, one line at a time and store it in an array using split() For each student: Use methods you have learned in other labs to determine if a student has any assignments with a grade of "0" If a student has at least 1 grade of "0": Use PrintWriter to create a new text file for them (or any other method of file creation you prefer). Make sure the name of the file is in the format described above. Print the first line of the file using text and the student's name as shown in the Example Run. Print the rest of the letter. Remember it is already stored in a single string. Use a for loop to evaluate each grade for the student. If the grade is "0", print text to the file indicating the Assignment number as shown in the Example Run. Close the PrintWriter. Reading an entire file into a String Variable The Scanner has several different methods you are not fully familiar with. .next() - The .next() method retrieves the next 'token' from the scanner input. But what is a token? A token is the next segment of text that comes from the Scanner before the next delimiter. But what is a delimiter? A delimiter is a String or pattern what defines how tokens are broken up in an input stream. By default, a Scanner's delimiter is white space. Therefore, the .next() method will read in all the characters from the input stream until it reaches the next white space where it will stop. .useDelimiter() - The .useDelimiter() method can be used to change the delimiter for the scanner. For example, calling .useDelimiter(",") will change the behavior of .next(). After setting the delimiter to "," the .next() method will read in all characters from the input stream until it reaches the next "," where it will stop. By setting the delimiter to a value you know is not found anywhere in an input file, and then calling .next(), you can successfully read the entire contents of a file into a String variable. Example: Scanner letter = new Scanner(letterFile); //Create a new Scanner object (letter) that points to a File. letter.useDelimiter("\\Z"); //Change the delimiter of the letter Scanner object to "\\Z" since you know that the string "\\Z" is not found anywhere in your .txt file. String letterBody = letter.next(); // .next() will read the entire contents of the file since the delimiter "\\Z" is not found in the .txt file. The String letterBody now contains the entire contents of the file. Example Run Your program output should look like this: Creating letters for: Garrett Wang Ethan Phillips Roxann Dawson Robert Beltran Robert McNeil Armin Shimerman Dominic Keating John Billings Before you run your program, your directory should look like this: Form Letter Creation - Befor.jpg After you run your program, your directory should look like this: Form Letter Creation - After.jpg Opening one of the sample letter files in a document editor should look like this: Letter.jpg
Warning Letter to Student -.txt
O Switch To Light Mode
se
I am concerned with your current progress in
CS 100. You have one or more missing
assignments which is greatly hurting your
grade. Please make every effort to get
assignments turned in for partial credit and
ensure you complete all future assignments on
time. I wish you the best in doing your part
to succeed in this class. See below for a
list of missing assignments.
Sincerly, Professor Roddenberry
***Missing Assignments***
Transcribed Image Text:Warning Letter to Student -.txt O Switch To Light Mode se I am concerned with your current progress in CS 100. You have one or more missing assignments which is greatly hurting your grade. Please make every effort to get assignments turned in for partial credit and ensure you complete all future assignments on time. I wish you the best in doing your part to succeed in this class. See below for a list of missing assignments. Sincerly, Professor Roddenberry ***Missing Assignments***
<
Student
Kate Mulgrew
Garrett Wang
Ethan Phillips
Jeri Ryan
Roxann Dawson
Robert Picardo
Student Assignment Scores.csv
Robert Beltran
Robert McNeil
Tim Russ
Nana Visitor
Avery Brooks
Alex Siddig
Rene Auberjonois
Armin Shimerman
Terry Farrell
Jolene Blalock
Scott Bakula
Conner Trinneer
Dominic Keating
Linda Park
John Billings
Anthony Montgomery
Asn 1 Asn 2 Asn 3 Asn 4 Asn 5 Asn 6
92
86
0
100
87
100
87
87
97
98
98
78
89
78
86
Switch To Light Mode
98
97
98
92
89
0
78
98
0
56
98
93
100
0
76
96
76
96
86
88
0
94
99
98
92
94
92
98
86
91
89
100
68 88
100
68
92 87
86
98
85
94
95
98
65
0
96
96
78
0
74
100
100
98
0
99
88
99
87 96
97
100 96
98 96
87
94
88
96
87
87
0
65
97
0
78
100
93
100
0
88
100
78
82
76
89
72
99
100
99
98
98
99
99
99
63
77
100
0
100
78
96
98
88 87
96
96
88
96
76
100
100
100
96
94
0
75
Transcribed Image Text:< Student Kate Mulgrew Garrett Wang Ethan Phillips Jeri Ryan Roxann Dawson Robert Picardo Student Assignment Scores.csv Robert Beltran Robert McNeil Tim Russ Nana Visitor Avery Brooks Alex Siddig Rene Auberjonois Armin Shimerman Terry Farrell Jolene Blalock Scott Bakula Conner Trinneer Dominic Keating Linda Park John Billings Anthony Montgomery Asn 1 Asn 2 Asn 3 Asn 4 Asn 5 Asn 6 92 86 0 100 87 100 87 87 97 98 98 78 89 78 86 Switch To Light Mode 98 97 98 92 89 0 78 98 0 56 98 93 100 0 76 96 76 96 86 88 0 94 99 98 92 94 92 98 86 91 89 100 68 88 100 68 92 87 86 98 85 94 95 98 65 0 96 96 78 0 74 100 100 98 0 99 88 99 87 96 97 100 96 98 96 87 94 88 96 87 87 0 65 97 0 78 100 93 100 0 88 100 78 82 76 89 72 99 100 99 98 98 99 99 99 63 77 100 0 100 78 96 98 88 87 96 96 88 96 76 100 100 100 96 94 0 75
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 6 steps with 4 images

Blurred answer
Knowledge Booster
Constants and Variables
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education