I'm doing a Java exercise and it requires me to create a note of the product sold, containing random numbers plus the first three letters of the customer as product code, but when I try to generate the winning note this error .
public Compra(){
String s = cliente.getNome();
String sub = s.substring(0, 4);
String num = String.valueOf((int)(Math.random()*10000+100));
numero = num + sub;
}
EDIT Class Purchase Complete
public class Compra{
private String numero;
private Cliente cliente;
private Vendedor vendedor;
private double precoOriginal;
private double desconto;
private double preco;
public Compra(double pO, double ds, double pF, Cliente client){
String s = cliente.getNome();
String sub = s.substring(0, 4);
String num = String.valueOf((int)(Math.random()*10000+100));
numero = num + sub;
precoOriginal = pO;
desconto = ds;
preco = pF;
cliente = client;
}
public Compra(double prO, double dst, double prF, Cliente client, Vendedor vend){
precoOriginal = prO;
desconto = dst;
preco = prF;
cliente = client;
vendedor = vend;
}
// CLASSE PARA TESTAR O NUMERO(CODIGO)
public Compra(){
String s = cliente.getNome();
String sub = s.substring(0, 4);
String num = String.valueOf((int)(Math.random()*10000+100));
numero = num + sub;
}
public void adDesconto(double desct){
preco = preco - (preco * desct);
}
public void setVendedor(Vendedor vend){
vendedor = vend;
}
}