@Override
public org.joda.money.Money computeCharge(org.joda.time.DateTime from,
org.joda.time.DateTime to){
}
Description copied from interface: Parkable
Compute the cost of parking in this lot between these times. Specified by:computeCharge in interface Parkable Parameters:from - The time the Vehicle is admitted. to - The time the vehicle is released. Returns:The cost of parking here.
For example, we charge 8 dollars per hour.
private void updateCharge() {
jtc.setText(jcb.getSelectedItem() + " for " + jtf.getText());
DateTime from = new DateTime(arriveTime.getDate());
DateTime to = new DateTime(departTime.getDate());
Period p = new Period(from, to);
Parkable pk = (Parkable) jcb.getSelectedItem();
pk.computeCharge(from, to);
jtc.setText(pk.computeCharge(from, to).toString());
System.out.println(jcb.getSelectedItem() + " for " + jtf.getText()
+ " costs " + pk.computeCharge(from, to));
}
The second coding is my calculator panel. So, the interface instance pk implements computeCharge method. Then, System.out.println(... "costs" + pk.computeCharge(from,to)). Please help me.