-2
Create a program to accept the typing of a person’s name and phone, while the name typed is different from QUIT. When typed EXIT, show the name and phone number of the first and last person typed, and the number of names typed.
I’m having trouble with everything I do, if anyone can help :)
my code:
* 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 atividade2;
import java.util.Scanner;
/**
*
* @author mojan
*/
public class Atividade2 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
String nome;
int numero;
String sair;
int count;
while(true){
Scanner leia = new Scanner(System.in);
System.out.println("Digite um nome");
nome = leia.nextLine();
System.out.println("Digite um número de telefone");
numero = leia.nextInt();
if(nome.equals("sair") || nome.isEmpty());
break;
}
}
}
Could you please [Dit] the question and add a better title that describes what your question is? " help here please" does not say what the question is about. Take advantage in editing and add in the body of the question also a description of your question. Error? Which one? Not working properly? When? Which entries did you put in? What outputs did you generate? What outputs were expected?
– Woss
sorry, ready
– joao
"I’m having trouble with everything I do"?
– Woss
Not directly related, but finally: telephone is not a number (in the sense of being a numerical value that represents a quantity or that can be calculated, etc). It is simply information that happens to use digits (but it can also have letters, not counting zeros on the left, that will disappear if you convert to number). Read here (despite not talking about phone, the problem is the same)
– hkotsubo