I want to convert a string of 5 numbers separated by commas into integers and store them into an array.
// 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 fixName()
{
String lower = Name.toLowerCase();
int a = Name.indexOf(" ",0);
String first = lower.substring(0, a);
String last = lower.substring(a+1);
char f = first.charAt(0);
char l = last.charAt(0);
f = Character.toUpperCase(f);
l = Character.toUpperCase(l);
String newname = "" + l + last.substring(1) + " " + f + first.substring(1);
}
public void fixScore()
{
int b = score.indexOf(",", 0);
int i = Integer.parseInt(b);
String[] b = score.split(",", 5);
System.out.print(b);
}
}