Question: JAVA CODING The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem,

JAVA CODING

The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly. Make sure the DebugCircle class compiles without error, the DebugCircle class methods work without error, the DebugFour1 class compiles without error and the DebugFour1 program accepts user input and displays the correct output.

An example of the program is shown below:

Enter a radius for a circle >> 7 The radius is 7 The diameter is 14 The area is 153.93791

FIRST CODE:

public class DebugCircle

{

private int radius;

private int diameter;

private final double PI = 3.14159;

private double area;

public DebugCircle() {}; // Do not remove this line

public DebugCircle(int r)

{

radius = r;

diameter = 2 * r;

area = PI * r * r;

}

public int getRadius();

{

return radiuss;

}

public void getDiameter()

{

return diameter;

}

public double getArea()

{

return area;

}}

SECOND CODE:

// This class uses a DebugCircle class

// to instantiate a Circle object

import java.util.Scanner;

public class DebugFour1

{

public static void main(String args[])

{

Scanner input = new Scanner(System.in);

int radius;

DebugCircle c = new Circle();

System.out.print("Enter a radius for a circle >> ");

radius = input.nextInt();

c = new DebugCircle(c);

System.out.println("The radius is " + c.getRad());

System.out.println("The diamter is " + c.getDiam());

System.out.println("The area is " + c.getArea());

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!