Assignments.docx
Assignment 1 Lab For all the labs this week, you will read the contents of a file and display the information on the screen in various ways. Download the file Student Assignment Scores.csv download . This file contains a list of students and the scores they received for 6 class assignments. Place this file in your PROJECT directory. Assume that your folder structure is similar to below. eclipse-workspace -> CS105 -> src -> week10 -> StudentScores1 Then, you would place the "Student Assignment Score" file in your CS105 directory. eclipse-workspace -> CS105 -> src -> week10 -> StudentScores1 The format of the file looks like this: Student, Asn 1, Asn 2, Asn 3, Asn 4, Asn 5, Asn 6 Kate Mulgrew, 92,98,91,96,97,99 Ethan....... When submitting this lab, submit a .java file called StudentAssignments1, and create the following structure in Eclipse: · Package Name: week10 · Class Name: StudentScores1 Write a program that uses a Scanner object to read from a file. Be sure that you instantiate the Scanner object inside of a try/catch statement but that the Scanner variable is visible outside of the try/catch scope. Using a while(xxxxxxx.hasNext()) structure, read each row of the file into a String variable. Print the String variable to the console. Example Run · Student,Asn 1,Asn 2,Asn 3,Asn 4,Asn 5,Asn 6 · Kate Mulgrew,92,98,91,96,97,99 Garrett Wang,86,0,89,78,0,99 Ethan Phillips,0,56,68,88,78,77 Jeri Ryan,100,98,100,100,100,100 Roxann Dawson,87,93,92,87,93,0 Robert Picardo,100,100,100,100,100,100 Robert Beltran,87,0,68,98,0,78 Robert McNeil,87,76,86,0,88,96 Tim Russ,97,96,98,99,100,98 Nana Visitor,98,76,85,88,78,96 Avery Brooks,98,96,94,99,82,96 Alex Siddig,78,86,95,87,76,88 Rene Auberjonois,89,88,98,94,89,96 Armin Shimerman,78,0,65,88,72,76 Terry Farrell,86,94,87,96,88,87 Jolene Blalock,98,99,97,96,99,100 Scott Bakula,97,98,100,96,100,100 Conner Trinneer,98,92,98,96,99,100 Dominic Keating,92,94,0,87,98,96 Linda Park,89,92,96,87,98,94 John Billings,0,98,0,0,99,0 Anthony Montgomery,78,86,74,65,63,75 · · · · Grading This assignment is worth 20 points and will be graded according to the following rubric: Rubric 10.4 Individual Lab Rubric. Criteria Ratings Pts This criterion is linked to a Learning Outcome The program uses the Scanner to read from the file one line at a time. 10 pts This criterion is linked to a Learning Outcome Student output looks like the example run. 10 pts Total Points: 20 Student Assignment Scores.csv Student Asn 1 Asn 2 Asn 3 Asn 4 Asn 5 Asn 6 Kate Mulgrew 92 98 91 96 97 99 Garrett Wang 86 0 89 78 0 99 Ethan Phillips 0 56 68 88 78 77 Jeri Ryan 100 98 100 100 100 100 Roxann Dawson 87 93 92 87 93 0 Robert Picardo 100 100 100 100 100 100 Robert Beltran 87 0 68 98 0 78 Robert McNeil 87 76 86 0 88 96 Tim Russ 97 96 98 99 100 98 Nana Visitor 98 76 85 88 78 96 Avery Brooks 98 96 94 99 82 96 Alex Siddig 78 86 95 87 76 88 Rene Auberjonois 89 88 98 94 89 96 Armin Shimerman 78 0 65 88 72 76 Terry Farrell 86 94 87 96 88 87 Jolene Blalock 98 99 97 96 99 100 Scott Bakula 97 98 100 96 100 100 Conner Trinneer 98 92 98 96 99 100 Dominic Keating 92 94 0 87 98 96 Linda Park 89 92 96 87 98 94 John Billings 0 98 0 0 99 0 Anthony Montgomery 78 86 74 65 63 75 Assignment 2 Lab When submitting this lab, submit a .java file called StudentAssignments2, and create the following structure in Eclipse: · Package Name: week10 · Class Name: StudentScores2 This lab requires that you add 6 lines of code to the previous lab; 4 before your while loop for the header and 2 inside the while loop for the formatted student data. Modify the previous lab to print the data in a formatted grid as shown in the example run. For the table Header · Read the first line of the file before you start your while loop—this row contains the header · Break the string into parts and store them in an array using String.split() · Use printf to print the data to the screen in a formatted table as shown in the example run For each row of Data in the table · Inside your while loop from the previous lab: · Comment out your previous print statement where you print out each line of text from the file. · Break the string into parts and store them in an array using String.split() · Use printf to print the data to the screen in a formatted table as shown in the example run For both the Header and the Data · Suggestion: Give the student name a width of 30 and each of the assignment scores a width of 7 Example Run · · Student Asn 1 Asn 2 Asn 3 Asn 4 Asn 5 Asn 6 · ------------------------------------------------------------------------------------- Kate Mulgrew 92 98 91 96 97 99 Garrett Wang 86 0 89 78 0 99 Ethan Phillips 0 56 68 88 78 77 Jeri Ryan 100 98 100 100 100 100 Roxann Dawson 87 93 92 87 93 0 Robert Picardo 100 100 100 100 100 100 Robert Beltran 87 0 68 98 0 78 Robert McNeil 87 76 86 0 88 96 Tim Russ 97 96 98 99 100 98 Nana Visitor 98 76 85 88 78 96 Avery Brooks 98 96 94 99 82