Okay - Here is the class called "Student"
public class Banks_Student
{
private String firstName;
private String middleInit;
private String lastName;
public String degreeInit;
public Banks_Student (String firstNameIn, String middleInitIn, String lastNameIn, String degreeInitIn)
{
firstName = firstNameIn;
middleInit = middleInitIn;
lastName = lastNameIn;
degreeInit = degreeInitIn;
}
public StringBuffer getFullName ()
{
StringBuffer wholeName = new StringBuffer ();
wholeName = new StringBuffer().append(firstName).append(middleInit).append(lastName).append (degreeInit);
return wholeName;
}
=========================================================================
...and here is create student
public class Banks_CreateStudent
{
String [] [] degreeList = {
{"AS", " AA", " BS", " BA", " MS", " MA", " PhD"},
{"Associate of Science", "Associate of Arts", "Bachelor of Science", "Bachelor of Arts", "Master of Science", "Master of Arts", "Doctor"}
};
public String addTitle(String title)
{
for (int i=0; i<7; ++i)
if (degreeList[0][i].equals(title))
{
title = degreeList [1] [i];
break;
}
return title;
}
public static void main (String [] args)
{
Banks_Student student1 = new Banks_Student ("Catherine ", "G ", "Banks ", "PhD ");
Banks_Student student2 = new Banks_Student ("Average ", "A ", "Joe ", "AA");
System.out.print (student1.getFullName());
System.out.println (student1.addTitle());
}
}
The goal is to print out the whole name along with the degree initials and the degree spelled out. It goes along fine until the "degree spelled out" part. Am I even barking up the right tree? How do I pass the "degreeInit" value to the addTitle method?
Many Thanks in Advance,
EB