Unos ejersicios de la facultad con Netbeans en Java...
a mi me dieron bien todos.. espero que a alguien le sirva... exitos!
EJERSICIO 5
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ejersicio5;
public class Pitagoras
{public static void main (String [] args)
{
int a,b,c;
a=48;
b=38;
double cc= Math.sqrt ((double)(a*a)+(b*b));
System.out.println((a*a)+(b*b));
System.out.println(("El valor de c=" )+(cc));
}
}
EJERSICIO 6
public class Circulo
{public static void main(String[] args)
{
int r = 3;
int R = 6;
double A1=3.14*(r*r);
double A2=3.14*(R*R);
System.out.println("Area 1"+"="+3.14*(r*r));
System.out.println("Area 2"+"="+3.14*(R*R));
System.out.println("Area 2 - Area 1 ="+(A2-A1));
}
}
EJERSICIO 7
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ejersicio7;
/**
*
* @author FACUNDO
*/
public class Ejersicio7
{
public static void main(String[] args)
{
int primerNumero;
int segundoNumero;
int tercerNumero;
int total;
System.out.println("ingrese el primer numero" );
primerNumero = TecladoIn.readLineInt();
System.out.println("ingrese el segundo numero" );
segundoNumero = TecladoIn.readLineInt();
System.out.println("ingrese el tercer numero" );
tercerNumero = TecladoIn.readLineInt();
total = primerNumero + segundoNumero + tercerNumero;
System.out.println("la suma de los tres numero ingresados es = " + total );
}
}
EJERSICIO 8
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ejersicio8;
/**
*
* @author FACUNDO
*/
public class AdivinaEdadejersicio8
{
public static void main(String [] args)
{
int añoNacimiento;
int edadDeseada;
int añoIncognita;
System.out.println("ingrese su año de nacimiento" );
añoNacimiento = TecladoIn.readLineInt();
System.out.println("ingrese edad deseada" );
edadDeseada = TecladoIn.readLineInt();
añoIncognita = añoNacimiento + edadDeseada;
System.out.println("Uste cumpliria "+ (edadDeseada)+" años," + " el año "+ (añoIncognita));
}
}
EJERSICIO 9
b]/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ejersicio9;
/**
*
* @author FACUNDO
*/
public class Ejersicio9
{
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
double nota1;
double nota2;
double nota3;
double promedio;
System.out.println("ingresar el valor de la primer nota" );
nota1 = TecladoIn.readLineDouble();
System.out.println("ingresar el valor de la segunda nota" );
nota2 = TecladoIn.readLineDouble();
System.out.println("ingresar el valor de la tercer nota" );
nota3 = TecladoIn.readLineDouble();
promedio= (nota1 + nota2 + nota3) /3;
System.out.println("EL PROMEDIO DE LAS NOTAS INTRODUCIDAS ES "+ (promedio));
}
}
[/b]
EJERSICIO 10
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ejersicio10;
/**
*
* @author FACUNDO
*/
public class Ejersicio10 {
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
double R;
double diametro;
double perimetro;
double superficie;
double volumen;
double superficieEsfera;
System.out.println("ingrese el valor de R" );
R = TecladoIn.readLineDouble();
diametro = (R)*(2);
perimetro = diametro*(3.14);
superficie = (3.14)* (R*R);
volumen = (4*(3.14)*(R*R*R))/3; //volumen de una esfera="(4*Pi*(R*R*R))/3"
superficieEsfera = (4*(3.14)*R); //superficie de una esfera="4*Pi*(R*R))
System.out.println("diametro = " + (diametro));
System.out.println("perimetro = " + (perimetro));
System.out.println("superficie = " + (superficie));
System.out.println("volumen de la esfera = " + (volumen));
System.out.println("superficie de la esfera = " + (superficieEsfera ));
}
}