|
Java output problem; cannot connect methods
Hey, I'm having problems getting my program to output. I've tried numerous ways, but I'm still pretty new at this. The rate at which my professor teaches isn't really helping, so it would be greatly appreciated if I could get some help. (I don't see a spoiler tag button, so I'm just going to post this, it's not very long)
import javax.swing.JOptionPane;
public class TestAccount {
public static void main(String[] args){
//Accounts array
Account[] accounts = new Account[4];
accounts[0] = new Account("111222333",1500.75,.25,5175.42);
accounts[1] = new Account("111222334",501.80,.15,150.32);
accounts[2] = new Account("111222335",1122.56,.225,3007.78);
accounts[3] = new Account("111222336",1201.77,.25,2004.35);
}
//Loop and Display
public void showMessage(Account[] accounts) {
String output = "";
for (int i=0; i<accounts.length; i++){
output += accounts[i].toString() + "\n";
}
JOptionPane.showMessageDialog(null, output, "Current Account", JOptionPane.PLAIN_MESSAGE);
}
}
Everything works but the output part, so if you have any hints...
|