Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assume that we have the following java code NewCircle.java: 1 public class NewCircle [ 2 int radius = 5 ; 3 double = 3 .

Assume that we have the following java code NewCircle.java:
1 public class NewCircle[
2 int radius =5;
3 double =3.1415;
4 public static void main(String [] arg)[
5 int k= radius;
6 sum();
7 public void sum 0[
8 double val=perimeter(radius);
9 System.out.printin(val);
10 public double perimeter(int k)[
11 retum (double) pi (:i**k}; }}
0- Save the file as NewCircle.java, compile it.
1- Identify how many syntax errors you are getting. (1 point)
2-Assume that there are two syntax errors. Provide the line numbers of both syntax errors.(3 points).
3- For line say x provide in details the syntax error that is taking place. (3 points).
4- For line say y provide in details the syntax error that is taking place. (3).
5- The code can be fixed by creating an object nc of the class NewCircle as follows:
NewCircle nc = new NewCircle();
identify the line at which you will place the above code. )
6- use nc to modify the above code so the lines that are causing the errors in 3- and 4- are fixed.()
7- Provide the value of val. Save the file that contains the corrected code as NewCricle1.java. Submit the code under: LastName_FirstName_NewCircle1.java.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Object Databases The Essentials

Authors: Mary E. S. Loomis

1st Edition

020156341X, 978-0201563412

More Books

Students also viewed these Databases questions