I am stuck in this below code, especially the below part
public String getBalanceForCid(double balance){
double b = 0;
if (cid = custid)
b = balance;
else
b;
return
b;
}
Please guide me the right way.
package practices;
public class Bank {
public Bank(){
cid = 0;
cname = "";
actno = 0;
balance = 0;
}
public Bank(int custid, String custname, int custno, double custbal){
cid = custid;
cname = custname;
actno = custno;
balance = custbal;
}
public void setCustid(int custid){
cid = custid;
}
public void setCustname(String custname){
cname = custname;
}
public void setCustno(int custno){
actno = custno;
}
public void setCustbal(double custbal){
balance = custbal;
}
public int getCustoid(){
return cid;
}
public String getCustname(){
return cname;
}
public int getCustno(){
return actno;
}
public double getCustbal(){
return balance;
}
public String getBalanceForCid(double balance){
double b = 0;
if (cid = custid)
b = balance;
else
b;
return
b;
}
private int cid;
private String cname;
private int actno;
private double balance;
}
above is my challenge (I am typing this message here again because I am getting message from SOF to add more details
Let's focus to getBalanceForCid(...) method:
you should read in manual about if/else
conditions
you should read in manual about types/returning data types from methods and generally about methods. Then about accessors and mutators in classes.