Question
In the following methods, find the error if any, circle the error part onlyand write the corrected change if any. (4 pt each) IN JAVA
In the following methods, find the error if any, circle the error part onlyand write the corrected change if any. (4 pt each) IN JAVA
(1) public double computeSumOfSquares(double a, double b) {
double sum;
sum = (a * a) + (b * b);
return sum;
}
(2) public int computeEquation1(int value, int value2, int k) {
int sum;
sum = (value1 * value2) + (k * value2);
return sum;
}
3. public void displayResult(double value, double rate, int years) {
double result;
result = value * (1+rate)years;
System.out.println(result);
}
4) Is this method correct for squaring an integer?
public static int square(int a) {
return
a * a;
}
(5) public double computeProduct (double num1, double num2) {
return (num1*num2);
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started