-
-
Save parzibyte/c55ac5a377fd7cc60f5b3fd60e30882a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
https://parzibyte.me/blog | |
*/ | |
import java.util.Scanner; | |
public class Main{ | |
public static double diferenciaKilovatios(double lecturaPresente, double lecturaPasada) { | |
return lecturaPresente - lecturaPasada; | |
} | |
public static double importeDeLuz(double lecturaPresente, double lecturaPasada) { | |
double costoPorConsumo = diferenciaKilovatios(lecturaPresente, lecturaPasada) * 3.5; | |
return costoPorConsumo + 100; | |
} | |
public static void main(String[] args) { | |
Scanner sc = new Scanner(System.in); | |
System.out.println("Ingresa la lectura presente: "); | |
double lecturaPresente = sc.nextDouble(); | |
System.out.println("Ingresa la lectura pasada: "); | |
double lecturaPasada = sc.nextDouble(); | |
double consumo = diferenciaKilovatios(lecturaPresente, lecturaPasada); | |
double importe = importeDeLuz(lecturaPresente, lecturaPasada); | |
System.out.println("Consumo: " + consumo + " Kilovatios " + " Importe: " + importe); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment