I keep on getting the following error, I've tried modifying the constructor, but I can't get it to work.
"C:\Users\Documents\NetBeansProjects\Assignment-1\src\Bank.java:34: cannot find symbol
symbol : constructor Customer(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String)
location: class Customer
Customer customer = new Customer(last, first, street, city, state, z, acctNum);
1 error
BUILD FAILED (total time: 0 seconds)
"
import javax.swing.JOptionPane;
import java.util.ArrayList;
import javax.swing.JTextArea;
import javax.swing.JScrollPane;
class Bank{
public static void main(String[] arg) {
boolean done = false;
final String menu = "1. New Account\n2. Close Account\n3. Active Accounts\n4. Inactive Accounts\n5. Exit";
Database db = new Database();
Database close = new Database();
while (!done) {
int option = GetData.getInt(menu);
switch (option) {
case 1:
String last = GetData.getWord("Enter last name:");
String first = GetData.getWord("Enter first name:");
String street = GetData.getWord("Enter street address:");
String city = GetData.getWord("Enter city:");
String state = GetData.getWord ("Enter state:");
String z = GetData.getWord("Enter zip code:");
String acctNum = GetData.getWord("Enter an account number:");
[B]Customer customer = new Customer(last, first, street, city, state, z, acctNum);[/B]
db.add(customer);
break;
case 2:
if (!db.empty()) {
acctNum = GetData.getWord("Enter account number:");
db.search(acctNum);
if (!db.inList()) {
acctNum = "Account number " + acctNum;
display("Account number not valid", "Message", JOptionPane.ERROR_MESSAGE);
} else {
int index = db.getIndex();
Customer c = (Customer) db.remove(index);
close.add(c);
}
} else {
display("At this point in time, there exists no accounts. Press 'OK' to continue.", "Message", JOptionPane.ERROR_MESSAGE);
}
break;
case 3:
ArrayList list = db.getList();
String str = "Active accounts:\n" + report(list);
JTextArea text = new JTextArea(str, 10, 30);
JScrollPane pane = new JScrollPane(text);
display(pane, "Report", JOptionPane.INFORMATION_MESSAGE);
break;
case 4:
ArrayList listd = close.getList();
String strd = "Inactive accounts:\n" + report(listd);
JTextArea textd = new JTextArea(strd, 10, 30);
JScrollPane paned = new JScrollPane(textd);
display(paned, "Report", JOptionPane.INFORMATION_MESSAGE);
break;
case 5:
display("Press 'OK' to quit", "Message", JOptionPane.WARNING_MESSAGE);
done = true;
break;
default:
display("Wrong option.", "Message", JOptionPane.ERROR_MESSAGE);
break;
}
}
}
static String report(ArrayList list) {
int length = list.size();
String str = "";
for (int i = 0; i < length; i++) {
Customer s = (Customer) list.get(i);
str = str + s.getName() + " " + s.getAddress() + " " + s.getacctNum() + "\n";
}
return str;
}
static void display(String info, String heading, int type) {
JOptionPane.showMessageDialog(null, info, heading, type);
}
static void display(JScrollPane pane, String heading, int type) {
JOptionPane.showMessageDialog(null, pane, heading, type);
}
}
class Customer {
String acctNum;
String firstname, lastname;
Name name;
Address address;
Customer(Name name, Address address, String aNum) {
this.acctNum = aNum;
this.name = name;
this.address = address;
}
String getacctNum() {
return acctNum;
}
Name getName(){
return name;
}
Address getAddress(){
return address;
}
// String getfirstname() {
// return firstname;
//}
//String getlastname() {
// return lastname;
// }
}
public class Name {
String firstname, lastname;
Name(String L, String f) {
firstname = f;
lastname = L;
}
String getfirstname() {
return firstname;
}
String getlastname() {
return lastname;
}
}
public class Address {
String street, city, state, zip;
Address(String st, String c, String s, String z) {
street = st;
city = c;
state = s;
zip = z;
}
String getstreet(){
return street;
}
String getcity(){
return city;
}
String getstate(){
return state;
}
String getzip(){
return zip;
}
}