Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package practical2part2;
- import java.util.Scanner;
- public class Mortage {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- System.out.println("Enter first salary: ");
- double firstSalary = input.nextDouble();
- System.out.println("Enter second salary: ");
- double secondSalary = input.nextDouble();
- System.out.println("Bigger salary is " + Mortage.whichSalaryIsBigger(firstSalary, secondSalary) + " and smaller is " + Mortage.whichSalaryIsSmaller(firstSalary, secondSalary));
- }
- public static double whichSalaryIsBigger(double s1, double s2) {
- if (s1 > s2)
- return s1;
- else
- return s2;
- }
- public static double whichSalaryIsSmaller(double s1, double s2) {
- if (s1 > s2)
- return s2;
- else
- return s1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement