-1
`public class VatCalculator {
Product product=new Product();
Airport airport=new Airport();
VATRates vatrates =new VATRates();
TaxTable taxtable= new TaxTable();
//private String vatTable;
// public VatCalculator(TaxTable taxTable) {
// `Z`super(taxTable);
// this.vatTable= generateVatTable();
// }
我需要在我的VatCalculator類中使用taxtable作爲輸入。我創建了一個對象,但不知道如何從TaxTable獲取數據。我怎樣才能做到這一點?如何使用json數據作爲我的輸入?
I am trying to create a Vat Calculator which calculates based on the taxtable.[vat class][1]
[data][2]
[1]: http://i.stack.imgur.com/r5MFs.png
[2]: http://i.stack.imgur.com/Ajj42.png
有一個名爲TaxTable的類,用於保存來自JSON文件(DB)的數據。 圖片:
public class TaxTable implements Serializable {
private static final long serialVersionUID = 1L;
private String taxGroup;
private double onboardSalePct;
private double onboardServicePct;
private double preorderSalePct;
private double preorderServicePct;
@JsonCreator
public TaxTable(@JsonProperty("tax_group") String taxGroup,
@JsonProperty("onboard_sale_pct") double onboardSalePct,
@JsonProperty("onboard_service_pct") double onboardServicePct,
@JsonProperty("preorder_sale_pct") double preorderSalePct,
@JsonProperty("preorder_service_pct") double preorderServicePct) {
this.taxGroup = taxGroup;
this.onboardSalePct = onboardSalePct;
this.onboardServicePct = onboardServicePct;
this.preorderSalePct = preorderSalePct;
this.preorderServicePct = preorderServicePct;
}
/**
* @return the taxGroup
*/
public String getTaxGroup() {
return taxGroup;
}
/**
* @param taxGroup
* the taxGroup to set
*/
public void setTaxGroup(String taxGroup) {
this.taxGroup = taxGroup;
}
您正在使用哪種語言? – deadman
它看起來像Java或至少代碼包含super()關鍵字。 – Perrier
請不要通過將代碼隱藏在外部鏈接背後的圖片來細分您的問題,請使用提供的代碼標籤將它們嵌入到您的問題中;這可能會吸引更多願意回答的人。 –