Please see the attachment for the detail.
Microsoft Word - JL_BCS345_201_homework3.docx BCS 345: Java Programming CRN 21177, 25160 JL Spring 2020 ----------------------------------------------------------------------------------------------------------------------------------------------------------------- Homework 3 Monday, March 9 Due Saturday, April 4, 11:59PM in Blackboard ----------------------------------------------------------------------------------------------------------------------------------------------------------------- Objectives: To learn to define and implement classes and use classes and objects to manipulate data. Tasks: Read the entire document before start NetBeans. Create a Java application project named BCS345hw3 which contains two public classes, BCS345hw3 and Student. The BCS345hw3 class serves as a driver program and the Student class defines fields and methods about a student object. Your program will read student’s ID, first name, last name, and 5 scores from an input file hw3data.txt, calculate the average test score after the lowest test score is dropped, and then assign a letter grade to student using the following grade scale: 90 <= average="">=><= 100="" a="" 80="">=><= average="">=>< 90="" b="" 70=""><= average="">=>< 80="" c="" 60=""><= average="">=>< 70="" d="" 0=""><= average="">=>< 60 f the program must output each student’s id, full name, 5 scores, average, and letter grade in a neat format similar to the sample output. a. (40 points) define the student class and implement it as required. the student class has the following private instance fields. no. instance fields description 1 id an int variable that holds a student’s id. 2 firstname a string variable that holds a student’s first name. 3 lastname a string variable that holds a student’s last name. 4 scores an int array that holds a student’s 5 test scores. the student class has the following public instance methods. no. instance methods description 1 no-arg constructor sets id to 0, firstname and lastname to “no name”, and all elements of scores to 0. 2 overloaded constructor accepts a student’s id, first name, last name, and an int array (storing 5 scores) as arguments to set the fields of a student object. 3 copy constructor uses the values of an existing student object to create and instantiate a new student object. 4 setid accepts an int argument and copies it into the id instance field. 5 setfname accepts a string argument and copies it into the firstname field. 6 setlname accepts a string argument and copies it into the lastname field. 7 setscores accepts an int array argument and copies it into the scores field. 8 getid returns the value in id. 9 getfname returns the value in firstname. 10 getlname returns the value in lastname. 11 getscores returns an int array that stores all 5 scores of a student object. 12 getaverage calculates the average test score after the lowest test score is dropped and returns the average test score as a floating-point value. precision must be kept in the calculation. 13 getgrade returns the letter grade based on the student’s average test score. hint: call the getaverage method to get the average score. 14 tostring output a student’s id, first name, last name, 5 test scores, average test score, and the letter grade. format the output and set each field to a fixed width. b. (20 points) in the driver program, write statements to test your class implementation including all the constructors and member methods. c. (40 points) suppose that the input data file contains the records of 25 students, in the driver program, use an array to manage 25 student objects, read from the data file, instantiate the student objects, process data, and output the results. code efficiency must be taken into consideration. the hw3data.txt file can be downloaded separately. assume all the data are valid. the data file must be placed directly in the project folder (at the same level of src folder) if file path is not provided. submission: submit your two source code files in blackboard. the file name are case-sensitive and must be bcs345hw3.java and student.java. use the default package for your project. points will be deducted for submission that doesn’t meet the name and package requirements. be sure to include the integrity statement i certify that this submission is my own original work with your name and ram id in all your source files. sample output for part c: 10001 alice brown89 85 92 99 90 10004 bob bush85 76 83 79 83 10010 carl capra65 57 73 68 76 10012 david lieberman76 68 79 81 58 10034 john menchin100 89 95 93 88 10056 george smith86 78 90 80 95 10062 elaine sanders85 79 90 80 95 10078 jack cunningham72 78 82 97 84 10090 susie brown68 85 80 84 83 10099 marvella garcia86 92 88 97 98 10120 tony peterson85 84 83 90 76 10129 john jones75 75 80 84 80 10131 mary evans60 72 89 86 65 10146 nancy drew78 80 75 90 85 10152 lola zapeta89 81 98 89 97 10155 duckey donald82 60 73 78 55 10163 goof goofy89 78 75 89 56 10168 brave balto100 98 93 89 92 10178 snow smitn93 76 54 83 80 10184 alice wonderful 86 79 87 78 67 10192 samina akthar85 62 78 45 60 10207 simba green50 45 35 60 20 10211 donald egger76 80 83 68 81 10216 brown deer86 87 89 79 75 10245 johny jackson96 85 91 83 79 60="" f="" the="" program="" must="" output="" each="" student’s="" id,="" full="" name,="" 5="" scores,="" average,="" and="" letter="" grade="" in="" a="" neat="" format="" similar="" to="" the="" sample="" output.="" a.="" (40="" points)="" define="" the="" student="" class="" and="" implement="" it="" as="" required.="" the="" student="" class="" has="" the="" following="" private="" instance="" fields.="" no.="" instance="" fields="" description="" 1="" id="" an="" int="" variable="" that="" holds="" a="" student’s="" id.="" 2="" firstname="" a="" string="" variable="" that="" holds="" a="" student’s="" first="" name.="" 3="" lastname="" a="" string="" variable="" that="" holds="" a="" student’s="" last="" name.="" 4="" scores="" an="" int="" array="" that="" holds="" a="" student’s="" 5="" test="" scores.="" the="" student="" class="" has="" the="" following="" public="" instance="" methods.="" no.="" instance="" methods="" description="" 1="" no-arg="" constructor="" sets="" id="" to="" 0,="" firstname="" and="" lastname="" to="" “no="" name”,="" and="" all="" elements="" of="" scores="" to="" 0.="" 2="" overloaded="" constructor="" accepts="" a="" student’s="" id,="" first="" name,="" last="" name,="" and="" an="" int="" array="" (storing="" 5="" scores)="" as="" arguments="" to="" set="" the="" fields="" of="" a="" student="" object.="" 3="" copy="" constructor="" uses="" the="" values="" of="" an="" existing="" student="" object="" to="" create="" and="" instantiate="" a="" new="" student="" object.="" 4="" setid="" accepts="" an="" int="" argument="" and="" copies="" it="" into="" the="" id="" instance="" field.="" 5="" setfname="" accepts="" a="" string="" argument="" and="" copies="" it="" into="" the="" firstname="" field.="" 6="" setlname="" accepts="" a="" string="" argument="" and="" copies="" it="" into="" the="" lastname="" field.="" 7="" setscores="" accepts="" an="" int="" array="" argument="" and="" copies="" it="" into="" the="" scores="" field.="" 8="" getid="" returns="" the="" value="" in="" id.="" 9="" getfname="" returns="" the="" value="" in="" firstname.="" 10="" getlname="" returns="" the="" value="" in="" lastname.="" 11="" getscores="" returns="" an="" int="" array="" that="" stores="" all="" 5="" scores="" of="" a="" student="" object.="" 12="" getaverage="" calculates="" the="" average="" test="" score="" after="" the="" lowest="" test="" score="" is="" dropped="" and="" returns="" the="" average="" test="" score="" as="" a="" floating-point="" value.="" precision="" must="" be="" kept="" in="" the="" calculation.="" 13="" getgrade="" returns="" the="" letter="" grade="" based="" on="" the="" student’s="" average="" test="" score.="" hint:="" call="" the="" getaverage="" method="" to="" get="" the="" average="" score.="" 14="" tostring="" output="" a="" student’s="" id,="" first="" name,="" last="" name,="" 5="" test="" scores,="" average="" test="" score,="" and="" the="" letter="" grade.="" format="" the="" output="" and="" set="" each="" field="" to="" a="" fixed="" width.="" b.="" (20="" points)="" in="" the="" driver="" program,="" write="" statements="" to="" test="" your="" class="" implementation="" including="" all="" the="" constructors="" and="" member="" methods.="" c.="" (40="" points)="" suppose="" that="" the="" input="" data="" file="" contains="" the="" records="" of="" 25="" students,="" in="" the="" driver="" program,="" use="" an="" array="" to="" manage="" 25="" student="" objects,="" read="" from="" the="" data="" file,="" instantiate="" the="" student="" objects,="" process="" data,="" and="" output="" the="" results.="" code="" efficiency="" must="" be="" taken="" into="" consideration.="" the="" hw3data.txt="" file="" can="" be="" downloaded="" separately.="" assume="" all="" the="" data="" are="" valid.="" the="" data="" file="" must="" be="" placed="" directly="" in="" the="" project="" folder="" (at="" the="" same="" level="" of="" src="" folder)="" if="" file="" path="" is="" not="" provided.="" submission:="" submit="" your="" two="" source="" code="" files="" in="" blackboard.="" the="" file="" name="" are="" case-sensitive="" and="" must="" be="" bcs345hw3.java="" and="" student.java.="" use="" the="" default="" package="" for="" your="" project.="" points="" will="" be="" deducted="" for="" submission="" that="" doesn’t="" meet="" the="" name="" and="" package="" requirements.="" be="" sure="" to="" include="" the="" integrity="" statement="" i="" certify="" that="" this="" submission="" is="" my="" own="" original="" work="" with="" your="" name="" and="" ram="" id="" in="" all="" your="" source="" files.="" sample="" output="" for="" part="" c:="" 10001="" alice="" brown="" 89="" 85="" 92="" 99="" 90="" 10004="" bob="" bush="" 85="" 76="" 83="" 79="" 83="" 10010="" carl="" capra="" 65="" 57="" 73="" 68="" 76="" 10012="" david="" lieberman="" 76="" 68="" 79="" 81="" 58="" 10034="" john="" menchin="" 100="" 89="" 95="" 93="" 88="" 10056="" george="" smith="" 86="" 78="" 90="" 80="" 95="" 10062="" elaine="" sanders="" 85="" 79="" 90="" 80="" 95="" 10078="" jack="" cunningham="" 72="" 78="" 82="" 97="" 84="" 10090="" susie="" brown="" 68="" 85="" 80="" 84="" 83="" 10099="" marvella="" garcia="" 86="" 92="" 88="" 97="" 98="" 10120="" tony="" peterson="" 85="" 84="" 83="" 90="" 76="" 10129="" john="" jones="" 75="" 75="" 80="" 84="" 80="" 10131="" mary="" evans="" 60="" 72="" 89="" 86="" 65="" 10146="" nancy="" drew="" 78="" 80="" 75="" 90="" 85="" 10152="" lola="" zapeta="" 89="" 81="" 98="" 89="" 97="" 10155="" duckey="" donald="" 82="" 60="" 73="" 78="" 55="" 10163="" goof="" goofy="" 89="" 78="" 75="" 89="" 56="" 10168="" brave="" balto="" 100="" 98="" 93="" 89="" 92="" 10178="" snow="" smitn="" 93="" 76="" 54="" 83="" 80="" 10184="" alice="" wonderful="" 86="" 79="" 87="" 78="" 67="" 10192="" samina="" akthar="" 85="" 62="" 78="" 45="" 60="" 10207="" simba="" green="" 50="" 45="" 35="" 60="" 20="" 10211="" donald="" egger="" 76="" 80="" 83="" 68="" 81="" 10216="" brown="" deer="" 86="" 87="" 89="" 79="" 75="" 10245="" johny="" jackson="" 96="" 85="" 91="" 83=""> 60 f the program must output each student’s id, full name, 5 scores, average, and letter grade in a neat format similar to the sample output. a. (40 points) define the student class and implement it as required. the student class has the following private instance fields. no. instance fields description 1 id an int variable that holds a student’s id. 2 firstname a string variable that holds a student’s first name. 3 lastname a string variable that holds a student’s last name. 4 scores an int array that holds a student’s 5 test scores. the student class has the following public instance methods. no. instance methods description 1 no-arg constructor sets id to 0, firstname and lastname to “no name”, and all elements of scores to 0. 2 overloaded constructor accepts a student’s id, first name, last name, and an int array (storing 5 scores) as arguments to set the fields of a student object. 3 copy constructor uses the values of an existing student object to create and instantiate a new student object. 4 setid accepts an int argument and copies it into the id instance field. 5 setfname accepts a string argument and copies it into the firstname field. 6 setlname accepts a string argument and copies it into the lastname field. 7 setscores accepts an int array argument and copies it into the scores field. 8 getid returns the value in id. 9 getfname returns the value in firstname. 10 getlname returns the value in lastname. 11 getscores returns an int array that stores all 5 scores of a student object. 12 getaverage calculates the average test score after the lowest test score is dropped and returns the average test score as a floating-point value. precision must be kept in the calculation. 13 getgrade returns the letter grade based on the student’s average test score. hint: call the getaverage method to get the average score. 14 tostring output a student’s id, first name, last name, 5 test scores, average test score, and the letter grade. format the output and set each field to a fixed width. b. (20 points) in the driver program, write statements to test your class implementation including all the constructors and member methods. c. (40 points) suppose that the input data file contains the records of 25 students, in the driver program, use an array to manage 25 student objects, read from the data file, instantiate the student objects, process data, and output the results. code efficiency must be taken into consideration. the hw3data.txt file can be downloaded separately. assume all the data are valid. the data file must be placed directly in the project folder (at the same level of src folder) if file path is not provided. submission: submit your two source code files in blackboard. the file name are case-sensitive and must be bcs345hw3.java and student.java. use the default package for your project. points will be deducted for submission that doesn’t meet the name and package requirements. be sure to include the integrity statement i certify that this submission is my own original work with your name and ram id in all your source files. sample output for part c: 10001 alice brown89 85 92 99 90 10004 bob bush85 76 83 79 83 10010 carl capra65 57 73 68 76 10012 david lieberman76 68 79 81 58 10034 john menchin100 89 95 93 88 10056 george smith86 78 90 80 95 10062 elaine sanders85 79 90 80 95 10078 jack cunningham72 78 82 97 84 10090 susie brown68 85 80 84 83 10099 marvella garcia86 92 88 97 98 10120 tony peterson85 84 83 90 76 10129 john jones75 75 80 84 80 10131 mary evans60 72 89 86 65 10146 nancy drew78 80 75 90 85 10152 lola zapeta89 81 98 89 97 10155 duckey donald82 60 73 78 55 10163 goof goofy89 78 75 89 56 10168 brave balto100 98 93 89 92 10178 snow smitn93 76 54 83 80 10184 alice wonderful 86 79 87 78 67 10192 samina akthar85 62 78 45 60 10207 simba green50 45 35 60 20 10211 donald egger76 80 83 68 81 10216 brown deer86 87 89 79 75 10245 johny jackson96 85 91 83 79>