Write Following Program Java Write Class Called Namemethods Contains Following Instance Va Q43901043
Write the following program in JAVA:
Write a class called NameMethods which contains the followinginstance variable and methods:
Instance Variable:
AvgLength- an integer preset to 0
Methods:
ReadNames: Given no values from the main method (i.e. noparameters), create a String array called names, read 50 names froma file called “names1.txt” into the array and return the array tothe main method
AvgCalc: Given a String array from the MAINMETHOD, determine the average length of the names in thearray. Store the average in the instance variable AvgLength. Do NOTreturn its value to the main method.
FindNames: Given a String array and a single letter fromthe main method, determine which friends have a name eitherstarting or ending with that letter. (Remember to deal with casesensitivity.) Write every name matching this criteria to a filecalled “names2.txt”. Do not output any values on screen and do notreturn any values to the main method.
You may declare any extra variables needed inside themethods.
Expert Answer
Answer to Write the following program in JAVA: Write a class called NameMethods which contains the following instance variable and…
OR