fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. static double computecommission(double s, double r)
  11. {
  12. System.out.println("First function");
  13. return s*r;
  14. }
  15.  
  16. static double computecommission(double s, int commr)
  17. {
  18. System.out.println("Second function");
  19.  
  20. commr= commr/100;
  21. return s*commr;
  22. }
  23.  
  24. public static void main (String[] args) throws java.lang.Exception
  25. {
  26. // your code goes here
  27. double sales,rate;
  28. int r;
  29. Scanner sc= new Scanner(System.in);
  30.  
  31. sales= sc.nextDouble();
  32. rate= sc.nextDouble();
  33. r=sc.nextInt();
  34.  
  35. double ans=computecommission(sales,rate);
  36. System.out.println("Answer: "+ ans);
  37.  
  38. ans=computecommission(sales,r);
  39. System.out.println("Answer: "+ ans);
  40.  
  41. }
  42. }
Success #stdin #stdout 0.11s 380608KB
stdin
2.7 3.53 2
stdout
First function
Answer: 9.531
Second function
Answer: 0.0