Noob here,
How would I create groups in my array?
receipt[] re11 = {["Book", 12.49, 1, false, true],["Music CD", 14.99, 1, false, false]};
I know in javascript you can use brackets like that but i just can't remember how to do in java.
Edit: Here are the rest of my classes. Sorry this will prob be a bit more help:
public class receipt {
private double price;
private Integer quantity;
private String itemName;
private boolean imported;
private boolean taxExemption;
private double basicTaxRate = .10;
private double importDuty = .05;
private double grandTotal;
public receipt(){
}
public receipt(String newItemName, double newPrice, Integer newQuantity, boolean newImported, boolean newTaxExemption){
itemName = newItemName;
price = newPrice;
quantity = newQuantity;
imported = newImported;
taxExemption = newTaxExemption;
}
//Accessors
public double getPrice(){
return price;
}
public Integer getQuantity(){
return quantity;
}
public String getItemName(){
return itemName;
}
public boolean getImported(){
return imported;
}
public boolean getTaxExemption(){
return taxExemption;
}
//mutators
public void setPrice(double newPrice){
//JOptionPane.showInputDialog("What is the price of the item?");
this.price = newPrice;
}
public void setQuantity(Integer newQuantity){
this.quantity = newQuantity;
}
public void setItemName(String newItemName){
this.itemName = newItemName;
}
public void setImported(boolean newImported){
this.imported = newImported;
}
public void setTaxExemption(boolean newTaxExemption){
this.taxExemption = newTaxExemption;
}
public double computeTax(){
if(imported == true){
return price*(1+(basicTaxRate+importDuty));
}
else{
return price*(1+basicTaxRate);
}
}
public double computeTotal(){
if (taxExemption = false){
return computeTax()*quantity;
}
else
return price*quantity;
}
public void computeGrandTotal(){
grandTotal =+ computeTotal();
//return grandTotal;
}