-3
To summarize well what I want, I will do so so that the program should run:
Digite o nome do vendedor: Joao
Digite a meta do vendedor: 1000
Digite o valor de vendas: 499
After this I need to make the program understand that if the target is less than 50% of sales, the seller will earn 1% or this example value should appear:
Seu lucro foi de 4,99.
But you have more else if
in this case, if the target is higher than 50 to 70%, it makes 2.5%, if it is 75.1 to 100% it makes 3.5% and if it is above 100% it makes 5%. I believe it was clear, what I did of code is below, I do not know how to put logic within the if parentheses.
public class Vendedor {
//definindo atributos
private String nome;
private double meta;
private double totalVendido;
//criacao do metodo para calcular a comissao do vendedor
public double calcularComissao() {
double valorVendido;
if (totalVendido < 0.5) {
valorVendido = (totalVendido * 0.01);
}else if(totalVendido ) {
valorVendido = (totalVendido * 0.025);
}else if(totalVendido ) {
valorVendido = (totalVendido * 0.035);
}else if(totalVendido ) {
valorVendido = (totalVendido * 0.05);
}else {
valorVendido = 0;
}
return valorVendido;
}
}
Important you [Dit] your question and explain objectively and punctually the difficulty found, accompanied by a [mcve] of the problem and attempt to solve. To better enjoy the site, understand and avoid closures and negativities worth reading the Stack Overflow Survival Guide in English.
– Bacco
Ta and tell me where I was not clear? It’s already clear the way I put it, I need it to run that way and I don’t know what I put inside the if, already said... We need better moderators
– felipi
Better moderators would do the same. If you want to discuss this post instead, correct, that is the site [meta]. Rest assured that if the problem is the moderator the community itself will reopen its post, everyone can vote reopening if they want.
– Bacco
Calm I will do even, because it is only here in Brazilian that is this way, I put in the American and already helped me with the same question, it is no wonder that Brazil is this way even, if no one had understood, they had not answered me, but apparently it was just you have to have more interpretation of things, because you put to say the problem, being that already said "I do not know what to put in the if" and attempt to solution, already put the code, need more than? I draw for you?
– felipi
Incidentally, there is a problem of text interpretation, nowhere has it been said that your post is unclear. I suggest to improve reading of text, and read the links indicated. There is more than explained the reason for closing your questions (and I won’t even need to draw!). As I said, if you want to discuss this, do it in the right place, link already passed before.
– Bacco
Okay, I think you’re more accurate than I am, what would be objective and punctual? Clarissimo, more objective and punctual than I was, I need it to run that way and I don’t know how to do the if ready, or is it just you who likes to read in a line? Just as many here are students, and are beginners, and if I don’t see logic I won’t learn.
– felipi
And other you don’t have to meddle, if there was no complaint from my post.
– felipi
@You are in a public place where everyone can get involved, if you are not comfortable with this ask your questions in a private place that no one will get involved. Some people are experienced here and can help in ways that you cannot imagine, and precisely from this experience we know that it will not always be perceived, we understand that people want the easy solution , even if wrong, confusing. Clearly you’re not open to an answer other than what you want to hear, so it gets tricky
– Maniero
It’s an obligation I took on as a moderator. My role, among others is to ensure quality of collective content, your question in the current form does not add to the collective, so it does not serve for the site. As guest, you can discuss the subject in the correct place, and can improve the posting as guest in the first comment (with the appropriate guidelines). The rest is a waste of precious time with something not worth it. To stop the problem, the comments of this post have been blocked. The site link for discussion on the site was passed above, feel free to use, in a civilized way..
– Bacco