Write a method named raiseSalary that accepts two integers as an argument and return its sum multiplied by 15%. Write a tester program to test the method. The class name should be your ID(for example: Id12345678).
Your answer should include a screenshot of the output. Otherwise, you will be marked zero for this question.
JAVA Code:
import java.util.*;
//class declaration
public class Id12345678 {
//method declaration
float raiseSalary(float x, float y) {
//calculation
float result = (x + y) * 15 / 100;
return result;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
//input 2 values x & y
System.out.println("Enter 2 values");
float x = sc.nextFloat();
float y = sc.nextFloat();
//printing output with function call
System.out.println("Result= " + new Id12345678().raiseSalary(x, y));
}
}
OUTPUT:
Get Answers For Free
Most questions answered within 1 hours.