Practica Desarrollada 2
Practica Desarrollada 2
Código:
package cramer;
import java.util.Scanner;
if (a * d - b * c == 0)
System.out.println("La ecuacion no tiene solucion. ");
else
{
double x = (e * d - b * f) / (a * d - b * c);
double y = (a * f - e * c) / (a * d - b * c);
System.out.println("x es " + x + ", y es " + y);
}
}
}
IMPRESIÓN:
Pregunta 2:
Código:
package ejerciciogeom;
import java.util.Scanner;
System.out.print("Ingrese: x1, y1, x2, y2, x3, y3, x4, y4: ");
double x1 = input.nextDouble();
double y1 = input.nextDouble();
double x2 = input.nextDouble();
double y2 = input.nextDouble();
double x3 = input.nextDouble();
double y3 = input.nextDouble();
double x4 = input.nextDouble();
double y4 = input.nextDouble();
// Display results
if (a * d - b * c == 0)
{
System.out.println("Las dos lineas son paralelas ");
}
else
{
double x = (e * d - b * f) / (a * d - b * c);
double y = (a * f - e * c) / (a * d - b * c);
System.out.println("El punto de interseccion es (" + x + ", " + y + ")");
}
}
}
Impresión:
Problema 3
Código:
package posicion;
import java.util.Scanner;
public class Posicion {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
Código:
}
}
class Account {
private int id = 0;
private double balance = 0.0;
private static double annualInterestRate = 0.0;
private java.util.Date diacreado;
public Account() {
diacreado = new java.util.Date();
}
Impresión:
Pregunta 5:
package account;
import java.util.Scanner;
while (true) {
menuDisplay();
System.out.print("Ingrese una opcion ");
int choice = in.nextInt();
if (choice == 4) {
System.out.printf("%nIngrese un id del 1 al 10: ");
id = in.nextInt();
Impresión: