my first application in java

in #steemiteducation7 years ago (edited)

hello community of steemit, today I want to share my first program in the programming language in java.

actually I am in second year of my career in the university and in this year , we are learning the language of programing "java" , previously we learned the language of programing "C Sharp" and it was my first programming language .

the unique function is calculate the base of the equilateral triangle.

My code

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
triangulo triangulo = new triangulo();
double val=Double.parseDouble(txt_val.getText());
double val2=Double.parseDouble(txt_base.getText());
double resultado=val+val2;
triangulo.altura=val;
triangulo.base=val2;
txt_resultado.setText(String.valueOf(triangulo.resul()));
}

class triangulo

public class triangulo {
public double base;
public double altura;
public double tot;
public double resul()
{
tot=(base*altura)/2;
return tot;
}
}

I know it is very little but it is a principle and I will strive to learn more and become a great software developer

Sort:  

E aí Joel, tudo bem? Bem-vindo ao mundo Java =D
Muito legal ver você utilizando componentes de tela para suas aplicações. Só uma dica, tente evitar as telas "clica e arrasta" do NetBeans, elas geram muita sujeira de código e as vezes confunde um pouco no início.
Também vou postando algumas coisas de Java nos meus posts, e nada muito avançado, sinta-se a vontade para acompanhar. Abs =D

Obrigado pela sugestão do amigo, eu estou seguindo você

Baia baia, interesante, tengo que practicar mas

saludos y gracias por leer mi post

Coin Marketplace

STEEM 0.16
TRX 0.13
JST 0.027
BTC 59588.19
ETH 2572.25
USDT 1.00
SBD 2.50