/** * Note: In this problem set level you will use inner classes by defining cus
ID: 3713220 • Letter: #
Question
/**
* Note: In this problem set level you will use inner classes by defining custom classes
* inside the ProblemSet_jng45_0020 class. This is only done so you can submit multiple
* classes in a single java file on AutoLab. In most cases it is better practice to define
* each class in a separate file instead of using inner classes.
*
* For labs and projects you will write your classes in separate files and submit a single
* jar file containing your entire project
*/
/**
* q1: Write a public class named InInts with the following.
* -A public constructor that takes 2 doubles as inputs.
* -A public method named compute that takes no parameters and returns the the square root of
* the first constructor input to the power of the the sine of the second constructor input
* as a double. You will need to store the constructor input in instance variables to be able
* to access them in the compute method
*/
Explanation / Answer
InInts.java
public class InInts {
private double a,b;
public InInts(double a, double b) {
this.a = a;
this.b = b;
}
public double compute() {
return Math.pow(a, Math.signum(b));
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.