Cześć,
Mam mały problem z przeniesieniem danych z 2 wymiarowej tablicy Stringów reprezentującej dane o produktach wybranych przez klienta
{"Nr", "Firma", "Nazwa ", "Ilość", "Cena"}; do nowego obiektu odpowiadającego wydrukowi na paragonie za pośrednictwem np: konstruktora
oto dane składowe
private int transactionId;
private String[] transactionCompanyName; //dane[i][1]
private String[] transactionStuffName; //dane[i][2]
private int[] transactionStuffAmount; //dane[i][3]
private double[] tansacationStuffPrice;//dane[i][4]
private double[] transactionTotalPrice;
private LocalDate transactionDate;
private int sellerID; //userID-seller
static int indexOfTransaction;
konstruktor po którym wyrzuca mi java.lang.NullPointerException przy pierwszym this w pętli
Selling(String data[][], User userLogin){
getIndexOfTransaction();
this.transactionId = indexOfTransaction;
this.sellerID = userLogin.getUserId();
for(int i =0;i<Gui.counter;i++){
this.transactionCompanyName[i] = data[i][1];
this.transactionStuffName[i] = data[i][2];
this.transactionStuffAmount[i] = Integer.parseInt(data[i][3]);
this.tansacationStuffPrice[i] = Double.parseDouble(data[i][4]);
this.transactionTotalPrice[i] = totalAmount(data, Gui.counter);
this.transactionDate = LocalDate.now();
}
}