Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package questaoEmpregados;
- public class Empregados {
- private String nome[] = new String[5];
- private String funcao[] = new String[5];
- private double acrescimo[] = new double[5];
- private double salario[] = new double[5];
- public String[] getNome() {
- return nome;
- }
- public void setNome(String[] nome) {
- this.nome = nome;
- }
- public String[] getFuncao() {
- return funcao;
- }
- public void setFuncao(String[] funcao) {
- this.funcao = funcao;
- }
- public double[] getAcrescimo() {
- return acrescimo;
- }
- public void setAcrescimo(double[] acrescimo) {
- this.acrescimo = acrescimo;
- }
- public double[] getSalario() {
- return salario;
- }
- public void setSalario(double[] salario) {
- this.salario = salario;
- }
- public void dados(){
- nome[0] = "nome1";
- nome[1] = "nome2";
- nome[2] = "nome3";
- nome[3] = "nome4";
- nome[4] = "nome5";
- funcao[0] = "funcao1";
- funcao[1] = "funcao2";
- funcao[2] = "funcao3";
- funcao[3] = "funcao4";
- funcao[4] = "funcao5";
- salario[0] = 5000;
- salario[1] = 1000;
- salario[2] = 3000;
- salario[3] = 3005;
- salario[4] = 5130;
- for(int i = 0; i< funcao.length; i++){
- if(funcao[i].equals("funcao1")){
- acrescimo[i] = salario[i] * 1.10;
- }
- else if(funcao[i].equals("funcao2")){
- acrescimo[i] = salario[i] * 1.05;
- }
- else if(funcao[i].equals("funcao3")){
- acrescimo[i] = salario[i] * 1.15;
- }
- else if(funcao[i].equals("funcao4")){
- acrescimo[i] = salario[i] * 1.20;
- }
- else if(funcao[i].equals("funcao5")){
- acrescimo[i] = salario[i] * 1.35;
- }
- }
- for(int i = 0; i < 5; i++){
- System.out.println("Empregado de nome: "+nome[i]+" com função "+funcao[i]+" e salário de: "+salario[i]+". Seu salário com acrescimo é: "+acrescimo[i]);
- }
- }
- }
- //main
- package questaoEmpregados;
- public class EmpregadosTeste {
- public static void main(String[] args) {
- Empregados empregados = new Empregados();
- empregados.dados();
- }
- }
Add Comment
Please, Sign In to add comment