There is the + method in the Client class that calculates the discount and the points of the client, and at the end of the method, a Buying object should be instantiated, but I can not instantiate the purchase object.
Attributes and Builder of the "Buy" class:
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){
cliente = client;
String s = cliente.getNome();
String sub = s.substring(0, 3);
String num = String.valueOf((int)(Math.random()*10000+100));
numero = num + sub;
precoOriginal = pO;
desconto = ds;
preco = pF;
}
Client class method:
public Compra fazUmaCompra(double p){
double pf = 0;
double ds = 0;
if (p > 300){
if (pontos > 2000){
pf = p - (p * 0.05);
ds = pf - p;
pontos = 0;
}
else if (pontos > 1000){
pf = p - (p * 0.03);
ds = pf - p;
pontos = pontos - (int) p * 1;
}
else if (pontos > 500){
pf = p - (p * 0.02);
ds = pf - p;
pontos = pontos - (int) p * 1;
}
else
pf = p;
}
pontos = pontos + (int) p * 1;
Compra c = new Compra(p, ds, pf, this.Cliente);
return c;
When compiling, BlueJ marks "this.Customer" as an error. "Can not find symbol - variable Client. Thanks