GieeF

Untitled

May 11th, 2020
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. package lab11;
  2.  
  3. @FunctionalInterface
  4. interface IPodatek {
  5. int obliczPodatek(int stawka, int podstawa);
  6.  
  7. }
  8. class Podatek{
  9. public static double oblicz(int stawka, int podstawa, IPodatek fun) {
  10. double result;
  11. result = fun.obliczPodatek(stawka, podstawa);
  12. return result;
  13. }
  14. }
  15. public class Main {
  16.  
  17. public static void main(String[] args) {
  18. IPodatek fun = (stawka, podstawa) -> stawka*podstawa;
  19. System.out.println(Podatek.oblicz(23, 60000, fun));
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment