when the height is displayed on the screen it stands this way 165.0 and I wanted it displayed this way 1.65

Asked

Viewed 16 times

0

package rpessoa;

import java.util.Scanner;

public class Pessoa { private string name; int private dia; int private mes; int year; private double height; private int age;

 // Construtor
 /*public  testarPessoa(int Dia, int Mes, int Ano){

   Dia = dia;
   Mes = mes;
   Ano = ano;
}*/


//Set Nome, altura
public void setNome(String nome){
    this.nome = nome;

}
public void setAltura(double altura){
    this.altura = altura;
}

//  Set Data
public void setDia(int dia){
    this.dia = dia;
}
public void setMes(int mes){
    this.mes = mes;
}
public void setAno(int ano){
    this.ano = ano;
}

// Get Data
public int getdia(){
    return dia;
}
public int getmes(){
    return mes;
}
public int getano(){
    return ano;
}

//Get Nome Altura
public String getnome(){
    return nome;
}
public double getaltura(){
    return altura;

} // Screen printing public void dataPessoa(){ System.out.println("NAME --> " + name); System.out.println ("HEIGHT --> "+ height); System.out.println("AGE --> " + age); }

public void cadastrarPessoa(){

    Scanner ler = new Scanner(System.in);
    System.out. println("Digite o nome: ");
    nome = ler.nextLine();
    System.out.println("Digite sua Altura: ");
    altura = ler.nextDouble();
}

}

  • 2

    It’s pure math, I don’t understand why people think they need to do something more sophisticated than split it by 100.

  • exactly was so plundered in some command that I forgot the simple mathematics

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.