Print Account.java and ManageAccounts.java.
Compile your Student class.
for (init; condition; update) bodyWhen you find a space (' '), add the next character to the initials. (Remember that you can concatenate a character to a String.) So the loop will look something like this:
for each character in the name if this character is a space add the next character to the initialsOf course, this will work only if there is exactly one space between first/middle/last names, but we'll assume that for now.
System.out.println("Student 1: " + student1);This should compile, but notice what it does when you run it -- nothing very useful! When an object is printed, Java looks for a toString method for that object. This method must have no parameters and must return a string. If such a method exists for this object, it is called and the string it returns is printed. If no such method exists, a unique hexadecimal identifier for the object is printed (e.g., Student@3a56d7).
Add a toString method to your Student class that returns a string containing the student's name and test scores, e.g.:
Name: Joe Test1: 85 Test2: 91Note that the toString method does not call System.out.println -- it just returns a string.
Recompile your Student class and the Grades program (you shouldn't have to change the Grades program -- you don't have to call toString explicitly). Now see what happens when you print a student object -- much nicer!
Print Student.java and Grades.java.
HEADS 1 HEADS 2 TAILS TAILS TAILS HEADS 1 HEADS 2 HEADS 3 HEADS 4 TAILS HEADS 1 ...