rangga_hrdme

KINDS OF FUNCTION 1

Apr 26th, 2021
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.86 KB | None | 0 0
  1. public class Function {
  2.     // Procedure
  3.     public static void main(String[] args) {
  4.         Hallo();
  5.         interest(1_000_000, 5, 7);
  6.     }
  7.  
  8.     // Procedure
  9.     static void Hallo(){
  10.         System.out.println("Hai Universe...");
  11.     }
  12.  
  13.     // Function (PARAMETER)
  14.     static void interest(double money, double percent, double months){
  15.         var result = money * (percent/100) * (months/12);
  16.         int results = (int) result;
  17.         System.out.println("Money: "+money+" Percent: "+percent+" Month: "+months+" Interest: "+results+" Decimal: "+result);
  18.     }
  19. }
  20. /* 1. Function without parameter (Procedure), example: main()
  21.  * 2. Function with parameter, example: interest(parameter). interest() is constructor
  22.  * 3. Function with return (method)
  23.  */
  24. // Pray 4 Uyghur: https://bylinetimes.com/2020/08/24/death-is-everywhere-millions-more-uyghurs-missing/
Advertisement
Add Comment
Please, Sign In to add comment