Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. package practical2part2;
  2. import java.util.Scanner;
  3. public class Mortage {
  4. public static void main(String[] args) {
  5. Scanner input = new Scanner(System.in);
  6. System.out.println("Enter first salary: ");
  7. double firstSalary = input.nextDouble();
  8. System.out.println("Enter second salary: ");
  9. double secondSalary = input.nextDouble();
  10. System.out.println("Bigger salary is " + Mortage.whichSalaryIsBigger(firstSalary, secondSalary) + " and smaller is " + Mortage.whichSalaryIsSmaller(firstSalary, secondSalary));
  11.  
  12.  
  13. }
  14. public static double whichSalaryIsBigger(double s1, double s2) {
  15. if (s1 > s2)
  16. return s1;
  17. else
  18. return s2;
  19.  
  20. }
  21. public static double whichSalaryIsSmaller(double s1, double s2) {
  22. if (s1 > s2)
  23. return s2;
  24. else
  25. return s1;
  26.  
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement