Advertisement
hercioneto

Exercício Class Valores

Nov 14th, 2023
637
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.91 KB | None | 0 0
  1. public class Valores {
  2.     private Integer valorA,valorB,valorC,soma;
  3.  
  4.     public Integer getValorA() {
  5.         return valorA;
  6.     }
  7.  
  8.     public void setValorA(Integer valorA) {
  9.         this.valorA = valorA;
  10.     }
  11.  
  12.     public Integer getValorB() {
  13.         return valorB;
  14.     }
  15.  
  16.     public void setValorB(Integer valorB) {
  17.         this.valorB = valorB;
  18.     }
  19.  
  20.     public Integer getValorC() {
  21.         return valorC;
  22.     }
  23.  
  24.     public void setValorC(Integer valorC) {
  25.         this.valorC = valorC;
  26.     }
  27.  
  28.     public Integer getSoma() {
  29.         return soma;
  30.     }
  31.  
  32.     public void setSoma() {
  33.         this.soma = this.valorA+this.valorB;
  34.     }
  35.    
  36.     public void verificar(){
  37.         if (this.soma<this.valorC){
  38.             System.out.println("Valor da soma é menor que C");
  39.         } else {
  40.             System.out.println("Valor da soma é maior que C");
  41.         }
  42.     }
  43.    
  44.    
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement