0
PLZ HELP ME TO CORRECT THIS CODE
I AM PASTING THE CODE HELP TO MAKE IT CORRECT. https://code.sololearn.com/czdvy99tjoVF/?ref=app
4 odpowiedzi
+ 4
nextDouble and nextInt should be replaced with nextDouble(); and nextInt();
You missed parentheses ()
+ 4
And declare variables l, b, r.
You can't use them without declaration.
+ 3
Adarsh Dixit Simple thing is that first try to understand the error. When you run the program one error is coming like cannot find symbol. It's simple mean that you didn't defined the variable or method.
And you used nextInt and nextDouble which are method of scanner class. But in java method defined with parentheses (). So here nextInt will be as nextInt() and nextDouble will be as nextDouble (). Always remember this thing that method defined with parentheses () in java.
And also there should be break statement in switch after each case.
+ 3
Summarizing what had been pointed out earlier:
In case 1 section:
* No declaration of variable <l> and <b>
double l = sc.nextDouble(); //l=sc.nextDouble;
double b = sc.nextDouble();//b=sc.nextDouble;
In case 2 section:
* No declaration for variable <r>
double r = sc.nextDouble();//r=sc.nextDouble;
* Missing `break` statement. Execution flow will continue to `default` section.