Print Account.java and ManageAccounts.java.
for (init; condition; update) bodyYou can get the number of characters in a String with its length() method. When you find a space (' '), add the next character to the initials. (Remember that you can concatenate a character to a String using +.) 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 and run, but notice what it does -- 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 automatically -- you don't have to write the call in your program -- 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 ...You'll have to work a little on the formatting to get this to come out right (think about where you'll use print and where you'll use println).