Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/04/2010, 01:08
elruffo
 
Fecha de Ingreso: abril-2010
Mensajes: 3
Antigüedad: 14 años
Puntos: 0
acceso a metodos con el .

/**
* Write a description of class Account here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Account
{
private char acctType;
private double balance;
private String acctId;

public char getAcctType()
{
return acctType;
}
public double getBalance()
{
return balance;
}
public String getId()
{
return acctId;
}
public void setBalance(double amount)
{
balance = amount;
}
public void setAcctId(String id)
{
acctId = id;
}
public void setAcctType(char type)
{
acctType = type;
}
}

/**
* Write a description of class Customer here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Customer
{
private int custID;
private Account account;
private String firstName;
private String lastName;
private int numOfAccount;
private String cityName;
private String DOB;
private String emailAddress;
private String streetAddress;
private String phoneNumber;
private String zipOrPostalCode;


public String getAddress()
{
return streetAddress + cityName + zipOrPostalCode;
}
public Account getAccount()
{
return account;
}
public int getCustID()
{
return custID;
}
public String getEmail()
{
return emailAddress;
}
public String getName()
{
return lastName + "," + firstName;
}
public int getNumOfAccounts ()
{
return numOfAccount;
}
public String getPhone ()
{
return phoneNumber;
}
public String getDOB ()
{
return DOB;
}
public void setDOB (String birthDate)
{
DOB = birthDate;
}
public void setAddress (String street, String city, String postalCode)
{
streetAddress = street;
cityName = city;
zipOrPostalCode = postalCode;
}
public void setEmail (String email)
{
emailAddress = email;
}
public void setName (String lName, String fName)
{
lastName = lName;
firstName = fName;
}
public void setPhone(String phone)
{
phoneNumber = phone;
}
public void setAccount(Account account)
{
account = account;
}
}


/**
* Write a description of class Teller here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Teller
{
public static void main(String [] args)
{
Customer c1 = new Customer();
c1.setName("Rufino","Hernandez");
System.out.println("Customer names is " + c1.getName());
Account a1 = new Account();
a1.setBalance(1000.89);
c1.setAccount(a1);
System.out.println("Customer balance is " + a1.Account().getBalance); // error no encuentra simbolo para accesar al metodo Account favor indicar donde estuvo el error
}
}