Skip to content

Commit

Permalink
Curso de Java Netbeans Completo☕ [48.- POO retornar valores desde un …
Browse files Browse the repository at this point in the history
  • Loading branch information
programadornovato committed Sep 4, 2019
1 parent 0abe2ea commit a386f18
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 12 deletions.
41 changes: 41 additions & 0 deletions src/main/java/com/programadornovato/proy1/Calculadora.java
@@ -0,0 +1,41 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.programadornovato.proy1;

/**
*
* @author eugenio
*/
public class Calculadora {
public int suma(int a,int b){
int res=0;
if(a>0 && b>0){
res=a+b;
}
return res;
}
public int resta(int a,int b){
int res=0;
if(a>0 && b>0){
res=a-b;
}
return res;
}
public int multiplicacion(int a,int b){
int res=0;
if(a>0 && b>0){
res=a*b;
}
return res;
}
public int divicion(int a,int b){
int res=0;
if(a>0 && b>0){
res=a/b;
}
return res;
}
}
27 changes: 15 additions & 12 deletions src/main/java/com/programadornovato/proy1/holaMundo.java
Expand Up @@ -21,20 +21,23 @@ public class holaMundo {
* @param args the command line arguments
*/
public static void main(String[] args) {
auto vocho=new auto();
vocho.modelo="1980";
vocho.marca="vocho";
vocho.color="azul";
Calculadora cal=new Calculadora();
Scanner entra=new Scanner(System.in);
System.out.println("Humano ingresa tus 2 valores a sumar");
int resultado=cal.suma(entra.nextInt(), entra.nextInt());
System.out.println("Humano este es el resultado = "+resultado);

vocho.meterLlave("123456");
vocho.mando("enciende");
/*
vocho.enciende();
vocho.acelera();
vocho.frenar();
System.out.println("Marca "+vocho.marca);
*/
System.out.println("Humano ingresa tus 2 valores a restar");
resultado=cal.resta(entra.nextInt(), entra.nextInt());
System.out.println("Humano este es el resultado = "+resultado);

System.out.println("Humano ingresa tus 2 valores a multiplicar");
resultado=cal.multiplicacion(entra.nextInt(), entra.nextInt());
System.out.println("Humano este es el resultado = "+resultado);

System.out.println("Humano ingresa tus 2 valores a divicion");
resultado=cal.divicion(entra.nextInt(), entra.nextInt());
System.out.println("Humano este es el resultado = "+resultado);
}

}

0 comments on commit a386f18

Please sign in to comment.