-
Lenguaje
Java usando Scanner
-
Descripción
Un banco otorga un préstamo a sus clientes. Si estos tienen una edad entre 25 años y 50 años, el interés que cobra por el préstamo es del 10% ¿Cuánto deberá pagar el cliente al banco por el préstamo solicitado?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import java.util.Scanner;
public class InteresPorEdad {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
double edad, interes, pago, prestamo;
System.out.print("Ingresa el valor de edad: ");
edad = in.nextDouble();
in.nextLine();
System.out.print("Ingresa el valor de prestamo: ");
prestamo = in.nextDouble();
in.nextLine();
if(edad>=25&&edad<=50)
interes=prestamo*0.1;
else
interes=0;
pago=prestamo+interes;
System.out.println("Valor de interes: " + interes);
System.out.println("Valor de pago: " + pago);
}
}
public class InteresPorEdad {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
double edad, interes, pago, prestamo;
System.out.print("Ingresa el valor de edad: ");
edad = in.nextDouble();
in.nextLine();
System.out.print("Ingresa el valor de prestamo: ");
prestamo = in.nextDouble();
in.nextLine();
if(edad>=25&&edad<=50)
interes=prestamo*0.1;
else
interes=0;
pago=prestamo+interes;
System.out.println("Valor de interes: " + interes);
System.out.println("Valor de pago: " + pago);
}
}