Last active
April 30, 2017 14:36
-
-
Save Rafael11j/d6c69414dbc3a00b8463fff7987ec5a4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Cliente { | |
private String nome; | |
private String cpf; | |
private String end; | |
public String getNome() { | |
return nome; | |
} | |
public void setNome(String nome) { | |
this.nome = nome; | |
} | |
public String getCpf() { | |
return cpf; | |
} | |
public void setCpf(String cpf) { | |
this.cpf = cpf; | |
} | |
public String getEnd() { | |
return end; | |
} | |
public void setEnd(String end) { | |
this.end = end; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ContratoEmpresarial extends Cliente{ | |
private Cliente cliente; | |
private double valorImovel; | |
private int nFuncionarios; | |
private int nVisitasDiarias; | |
private int ramo; | |
public Cliente getCliente() { | |
return cliente; | |
} | |
public void setCliente(Cliente cliente) { | |
this.cliente = cliente; | |
} | |
public double getValorImovel() { | |
return valorImovel; | |
} | |
public void setValorImovel(double valorImovel) { | |
this.valorImovel = valorImovel; | |
} | |
public int getnFuncionarios() { | |
return nFuncionarios; | |
} | |
public void setnFuncionarios(int nFuncionarios) { | |
this.nFuncionarios = nFuncionarios; | |
} | |
public int getnVisitasDiarias() { | |
return nVisitasDiarias; | |
} | |
public void setnVisitasDiarias(int nVisitasDiarias) { | |
this.nVisitasDiarias = nVisitasDiarias; | |
} | |
public int getRamo() { | |
return ramo; | |
} | |
public void setRamo(int ramo) { | |
this.ramo = ramo; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ContratoResidencial extends Cliente { | |
private Cliente cliente; | |
private String end; | |
private double valorImovel; | |
private int zona; | |
private int tipo; | |
public Cliente getCliente() { | |
return cliente; | |
} | |
public void setCliente(Cliente cliente) { | |
this.cliente = cliente; | |
} | |
public String getEnd() { | |
return end; | |
} | |
public void setEnd(String end) { | |
this.end = end; | |
} | |
public double getValorImovel() { | |
return valorImovel; | |
} | |
public void setValorImovel(double valorImovel) { | |
this.valorImovel = valorImovel; | |
} | |
public int getZona() { | |
return zona; | |
} | |
public void setZona(int zona) { | |
this.zona = zona; | |
} | |
public int getTipo() { | |
return tipo; | |
} | |
public void setTipo(int tipo) { | |
this.tipo = tipo; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Main { | |
public static void main(String[] args) { | |
Scanner abre = new Scanner(System.in); | |
SeguroResidencial s = new SeguroResidencial(); | |
SeguroEmpresarial se = new SeguroEmpresarial(); | |
System.out.println("Digite o nome do cliente: "); | |
String nome = abre.nextLine(); | |
System.out.println("Digite o tipo do contrato (1 - Residencial) (2 - EMpresarial): "); | |
int tipo = abre.nextInt(); | |
if(tipo == 1){ | |
s.calculoResidencial(); | |
}else{ | |
se.calculoEMpresarial(); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class SeguroEmpresarial { | |
public void calculoEMpresarial(){ | |
Scanner abre = new Scanner(System.in); | |
double total; | |
ContratoResidencial c = new ContratoResidencial(); | |
System.out.println("Digite o valor do imóvel: "); | |
double valorImovel = abre.nextDouble(); | |
double seguro = (valorImovel * 0.04); | |
System.out.println("Digite o número de funcinários: "); | |
int nFuncionarios = abre.nextInt(); | |
total = seguro; | |
double valorFuncionarios = 0; | |
double valorRamo = 0; | |
if((nFuncionarios/10) >= 1){ | |
valorFuncionarios += (total*0.002); | |
} | |
System.out.println("Digite o número de visitas: "); | |
int nVisitas = abre.nextInt(); | |
double valorVisitas = 0; | |
if((nVisitas)/100 >= 2){ | |
valorVisitas += (total*0.003); | |
} | |
System.out.println("Digite o ramo da empresa (1 - comércio) (2 - indústria) (3 - agropecuária): "); | |
int ramo = abre.nextInt(); | |
if(ramo == 1){ | |
valorRamo += (total*0.005); | |
}else if(ramo == 2){ | |
valorRamo += (total*0.01); | |
} | |
total = seguro + valorFuncionarios + valorVisitas + valorRamo; | |
System.out.println("O valor de seguro empresarial é: "+ total); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class SeguroResidencial { | |
public void calculoResidencial(){ | |
Scanner abre = new Scanner(System.in); | |
double total; | |
ContratoResidencial c = new ContratoResidencial(); | |
System.out.println("Digite o valor do imóvel: "); | |
double valorImovel = abre.nextDouble(); | |
double seguro = (valorImovel * 0.02); | |
System.out.println("Digite o tipo da zona (1 - urbana) (2 - suburbana) (3 - rural): "); | |
int zona = abre.nextInt(); | |
System.out.println("Digite o tipo da residência (1 - casa) (2 - apartamento): "); | |
int tipo = abre.nextInt(); | |
total = valorImovel; | |
double valorZona = 0; | |
double valorTipo = 0; | |
if(zona == 1){ | |
valorZona += (total * 0.01); | |
}else if(zona == 2){ | |
valorZona += (total * 0.005); | |
} | |
if(tipo == 1){ | |
valorTipo = (total * 0.005); | |
} | |
total = seguro + valorZona + valorTipo; | |
System.out.println("O valor de seguro residencial é: "+ total); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment