Meu código abaixo está apresentando erros acho que de interpretação no netbeans. Como posso resolver ?
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package listadeexercicios1;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
*
* @author user
*/
public class lista1 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
String s = "";
int a1, n, r, an;
BufferedReader dado;
try
{
System.out.println("ENTRE COM O PRIMEIRO TERMO DA P.A:");
dado=new BufferedReader(new InputStreamReader(System.in));
s = dado.readline();
a1 = Integer.parseInt(s);
System.out.println("ENTRE COM A RAZÃO DA P.A:");
dado=new BufferedReader(new InputStreamReader(System.in));
s = dado.readline();
r = Integer.parseInt(s);
System.out.println("ENTRE COM O NUMERO DE TERMOS DA P.A:");
dado=new BufferedReader(new InputStreamReader(System.in));
s = dado.readline();
n = Integer.parseInt(s);
an = a1+(n-1 )*r;
System.out.println("O VALOR DE an: " + an);
}
catch (IOException erro)
{
System.out.println("Erro na entrada de dados");
}
catch ( NumberFormatException erro )
{
System.out.println("Houve erro na conversão,digite apenas caracteres numericos");
}
}
}
Pergunta
Bruno Pacheco
Meu código abaixo está apresentando erros acho que de interpretação no netbeans. Como posso resolver ?
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package listadeexercicios1; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; /** * * @author user */ public class lista1 { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here String s = ""; int a1, n, r, an; BufferedReader dado; try { System.out.println("ENTRE COM O PRIMEIRO TERMO DA P.A:"); dado=new BufferedReader(new InputStreamReader(System.in)); s = dado.readline(); a1 = Integer.parseInt(s); System.out.println("ENTRE COM A RAZÃO DA P.A:"); dado=new BufferedReader(new InputStreamReader(System.in)); s = dado.readline(); r = Integer.parseInt(s); System.out.println("ENTRE COM O NUMERO DE TERMOS DA P.A:"); dado=new BufferedReader(new InputStreamReader(System.in)); s = dado.readline(); n = Integer.parseInt(s); an = a1+(n-1 )*r; System.out.println("O VALOR DE an: " + an); } catch (IOException erro) { System.out.println("Erro na entrada de dados"); } catch ( NumberFormatException erro ) { System.out.println("Houve erro na conversão,digite apenas caracteres numericos"); } } }Editado por Bruno PachecoLink para o comentário
Compartilhar em outros sites
1 resposta a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.