Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Below are two classes. The person class and the 314 class (object). Embedded in

ID: 3542419 • Letter: B

Question

 
Below are two classes. The person class and the 314 class (object). Embedded in the code are comments that tell you what the professor is asking for. I have already written part of the person class.

Person class:
 
 // person class   public class person { private String Name; private char sex; private String score; private int[] grades = new int[5]; private String newName; public person() // CONSTRUCTOR {   } public void setName(String g) // RECEIVE NAME {Name = g; } public void setSex(char c) // RECEIVE SEX CODE {sex = c;}; public void setScore(String cat) // RECEIVE SCORES AS STRING {score = cat;} public void fixName() { /* HERE IS WHERE YOY TAKE YOUR STRING name CONVERT IT TO LOWWER CASE, BREAK IT INTO 2 STRINGS (FIRST AND LAST), CONVERT THE FIRST LETTER OF EACH PART TO CAPITAL, AND CONCATENATE IT BACK TOGETHER AND STORE IT IN newname. */ // Khan, Emad : M, 100, 98... String last, first; first = Name.substring(1, Name.indexOf(" ")); first = first.toLowerCase(); first = Name.charAt(0) + first; newName = Name.toLowerCase(); System.out.println(first); last = Name.substring(Name.indexOf(" ")+2, Name.length()); last = last.toLowerCase(); last = Name.charAt(Name.indexOf(" ")+1) + last; newName = Name.toLowerCase(); System.out.println(last);   } public void fixScore() { /*HERE YOU TAKE YOUR STRING CALLED scores ABOVE AND USE AND STORE IT IN YOUR INTEGER ARRAY CALLED GRADES (ABOVE). //10 objects sitting in this method //pp=(Person)vector.get(a) where a is 0-9 */ String score; //   //grades?   } public String getName() // RETURNS NEWNAME {return newName;} public char getSex() // RETURNS SEX CODE {return sex;} //---provide a function that will return the 5 scores for that person. //You cannot return an array reference.. find another way. }
 
 
 
 314 Class
 import java.io.RandomAccessFile; import java.io.EOFException; import java.io.IOException; import java.util.Vector;   public class First_314_Project { private RandomAccessFile raf; //The entire path to the location of the file private final String fileToRead = "DATA314.dat"; private Vector vector = new Vector(); private String temp; private int c=0; private person pp; private String[] Names = new String[10]; private char[] Sex = new char[10]; private int[][] Score = new int[10][5]; private float[] averages = new float[5]; private char[] letter = new char[10]; public First_314_Project() { int counter=0; try{ raf = new RandomAccessFile(fileToRead,"r"); do{ temp=raf.readUTF(); // raf is an object of the random access file class //System.out.println(temp); person p = new person(); int c = temp.indexOf(':'); String g = temp.substring(0,c); char b = temp.charAt(c+1); String cat = temp.substring(c+3,temp.length()); p.setName(g); p.setSex(b); p.setScore(cat); p.fixName(); //find the blank //get the first name //get the last name //use a substring command and grab position 1 through n-1 grab first name and leave the first letter alone // take them apart and concenate them to create the correct order of the names. dont forget to put the comma inbetween the two //last name first and then the first name //convert the whole thing to lower case first if i want to //capitalize the names in each part p.fixScore(); counter++; vector.add(p); // add person object to vector   } while(counter<10); counter=0; /* here you should read all you data back from the vector and store it in the arrays for sorting and printing */   pp= new person(); //for(int a=0; a<=9; a++) { //pp= (person)vector.get(a); //Names[a]=pp.getName();   //catch(Exception ex){} function1(); // remember to pass arrays function2(); // remember to pass arrays } catch(IOException e) {System.err.println("File Error:" + e);} }   public void function1( ) { // this function will receive all arrays and compute average, letter grade // and sort the arrays based upon average (high to low) // You must use a pointer technique -- I will explain }   public void function2( ) { //this function will do all printing //for(int a=0; a<=9; a++) { //System.out.println(Names[a]);   }   public static void main() { new First_314_Project(); } }

 import java.io.RandomAccessFile; import java.io.EOFException; import java.io.IOException; import java.util.Vector;   public class First_314_Project { private RandomAccessFile raf; //The entire path to the location of the file private final String fileToRead = "DATA314.dat"; private Vector vector = new Vector(); private String temp; private int c=0; private person pp; private String[] Names = new String[10]; private char[] Sex = new char[10]; private int[][] Score = new int[10][5]; private float[] averages = new float[5]; private char[] letter = new char[10]; public First_314_Project() { int counter=0; try{ raf = new RandomAccessFile(fileToRead,"r"); do{ temp=raf.readUTF(); // raf is an object of the random access file class //System.out.println(temp); person p = new person(); int c = temp.indexOf(':'); String g = temp.substring(0,c); char b = temp.charAt(c+1); String cat = temp.substring(c+3,temp.length()); p.setName(g); p.setSex(b); p.setScore(cat); p.fixName(); //find the blank //get the first name //get the last name //use a substring command and grab position 1 through n-1 grab first name and leave the first letter alone // take them apart and concenate them to create the correct order of the names. dont forget to put the comma inbetween the two //last name first and then the first name //convert the whole thing to lower case first if i want to //capitalize the names in each part p.fixScore(); counter++; vector.add(p); // add person object to vector   } while(counter<10); counter=0; /* here you should read all you data back from the vector and store it in the arrays for sorting and printing */   pp= new person(); //for(int a=0; a<=9; a++) { //pp= (person)vector.get(a); //Names[a]=pp.getName();   //catch(Exception ex){} function1(); // remember to pass arrays function2(); // remember to pass arrays } catch(IOException e) {System.err.println("File Error:" + e);} }   public void function1( ) { // this function will receive all arrays and compute average, letter grade // and sort the arrays based upon average (high to low) // You must use a pointer technique -- I will explain }   public void function2( ) { //this function will do all printing //for(int a=0; a<=9; a++) { //System.out.println(Names[a]);   }   public static void main() { new First_314_Project(); } }

 import java.io.RandomAccessFile; import java.io.EOFException; import java.io.IOException; import java.util.Vector;   public class First_314_Project { private RandomAccessFile raf; //The entire path to the location of the file private final String fileToRead = "DATA314.dat"; private Vector vector = new Vector(); private String temp; private int c=0; private person pp; private String[] Names = new String[10]; private char[] Sex = new char[10]; private int[][] Score = new int[10][5]; private float[] averages = new float[5]; private char[] letter = new char[10]; public First_314_Project() { int counter=0; try{ raf = new RandomAccessFile(fileToRead,"r"); do{ temp=raf.readUTF(); // raf is an object of the random access file class //System.out.println(temp); person p = new person(); int c = temp.indexOf(':'); String g = temp.substring(0,c); char b = temp.charAt(c+1); String cat = temp.substring(c+3,temp.length()); p.setName(g); p.setSex(b); p.setScore(cat); p.fixName(); //find the blank //get the first name //get the last name //use a substring command and grab position 1 through n-1 grab first name and leave the first letter alone // take them apart and concenate them to create the correct order of the names. dont forget to put the comma inbetween the two //last name first and then the first name //convert the whole thing to lower case first if i want to //capitalize the names in each part p.fixScore(); counter++; vector.add(p); // add person object to vector   } while(counter<10); counter=0; /* here you should read all you data back from the vector and store it in the arrays for sorting and printing */   pp= new person(); //for(int a=0; a<=9; a++) { //pp= (person)vector.get(a); //Names[a]=pp.getName();   //catch(Exception ex){} function1(); // remember to pass arrays function2(); // remember to pass arrays } catch(IOException e) {System.err.println("File Error:" + e);} }   public void function1( ) { // this function will receive all arrays and compute average, letter grade // and sort the arrays based upon average (high to low) // You must use a pointer technique -- I will explain }   public void function2( ) { //this function will do all printing //for(int a=0; a<=9; a++) { //System.out.println(Names[a]);   }   public static void main() { new First_314_Project(); } }

 import java.io.RandomAccessFile; import java.io.EOFException; import java.io.IOException; import java.util.Vector;   public class First_314_Project { private RandomAccessFile raf; //The entire path to the location of the file private final String fileToRead = "DATA314.dat"; private Vector vector = new Vector(); private String temp; private int c=0; private person pp; private String[] Names = new String[10]; private char[] Sex = new char[10]; private int[][] Score = new int[10][5]; private float[] averages = new float[5]; private char[] letter = new char[10]; public First_314_Project() { int counter=0; try{ raf = new RandomAccessFile(fileToRead,"r"); do{ temp=raf.readUTF(); // raf is an object of the random access file class //System.out.println(temp); person p = new person(); int c = temp.indexOf(':'); String g = temp.substring(0,c); char b = temp.charAt(c+1); String cat = temp.substring(c+3,temp.length()); p.setName(g); p.setSex(b); p.setScore(cat); p.fixName(); //find the blank //get the first name //get the last name //use a substring command and grab position 1 through n-1 grab first name and leave the first letter alone // take them apart and concenate them to create the correct order of the names. dont forget to put the comma inbetween the two //last name first and then the first name //convert the whole thing to lower case first if i want to //capitalize the names in each part p.fixScore(); counter++; vector.add(p); // add person object to vector   } while(counter<10); counter=0; /* here you should read all you data back from the vector and store it in the arrays for sorting and printing */   pp= new person(); //for(int a=0; a<=9; a++) { //pp= (person)vector.get(a); //Names[a]=pp.getName();   //catch(Exception ex){} function1(); // remember to pass arrays function2(); // remember to pass arrays } catch(IOException e) {System.err.println("File Error:" + e);} }   public void function1( ) { // this function will receive all arrays and compute average, letter grade // and sort the arrays based upon average (high to low) // You must use a pointer technique -- I will explain }   public void function2( ) { //this function will do all printing //for(int a=0; a<=9; a++) { //System.out.println(Names[a]);   }   public static void main() { new First_314_Project(); } }


Explanation / Answer

public void fixScore() { /*HERE YOU TAKE YOUR STRING CALLED scores ABOVE AND USE AND STORE IT IN YOUR INTEGER ARRAY CALLED GRADES (ABOVE). //10 objects sitting in this method //pp=(Person)vector.get(a) where a is 0-9 */ String score; // int parsedScore = Integer.parseInt(score); //this method returns an integer version of the string for(int i = 0; i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote