In the main program so that it calls the method named mystery , passing it the i
ID: 3614582 • Letter: I
Question
In the main program so that it calls the method namedmystery, passing it the input value, and printing theresult. I don't understand why l am getting an error message when ltry to compilemport javax.swing.*;
public class Lab7Mystery {
public static void main(String[] args) {
String input;
double x;
input =JOptionPane.showInputDialog("Enter a real number " +
"(must begreater than one):");
x =Double.parseDouble(input);
double mystery();
System.out.println("Theresult of mystery is:");
System.out.println(" End ofprocessing.");
}
public static double mystery(double a) {
long q = 1, b;
double x, xxx;
b = (long)a;
do {
b>>= 3;
q<<= 1;
} while (b != 0);
x = q;
xxx = x * x * x;
x = x * (xxx + a + a) / (xxx+ xxx + a);
xxx = x * x * x;
x = x * (xxx + a + a) / (xxx+ xxx + a);
xxx = x * x * x;
x = x * (xxx + a + a) / (xxx+ xxx + a);
xxx = x * x * x;
x = x * (xxx + a + a) / (xxx+ xxx + a);
return x;
}
}
Explanation / Answer
please rate - thanks import javax.swing.*; public class Lab7Mystery { public static void main(String[] args) { String input; double x,y; input =JOptionPane.showInputDialog("Enter a real number " + "(must be greater than one):"); x =Double.parseDouble(input); y= mystery(x); System.out.println("Theresult of mystery is:"+y); System.out.println(" End of processing."); } public static double mystery(double a) { long q = 1, b; double x, xxx; b = (long)a; do { b >>= 3; qRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.