The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 304 Weeks Ago, 2 Days Ago |
| Questions Answered: | 15833 |
| Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
I need to assistance making the following changes to the JAVA code, can anyone help?
Â
(1) Assignment instruction says, "The setRadius() method not only sets the radius but also calculates the other two values." However, your setRadius() sets only radius, not diameter and area.Â
(2)Â public circle3()
A constructor name is different form the class name. If class name is 'Circle', the constructor name should be 'Circle' too, not 'circle3' - remember that Java is case-sensitive.
(3) Class Circle is a non-static class, so you need a static class for the main program. Without the main program, any non-static class won't be run. So, make a main program (testCircle.java).
Â
package circle3;
Â
public class circle3 {
Â
  private final double PI = 3.14159;
  private double radius;
Â
  public circle3() {
    radius = 1.0;
  Â
      }
Â
 Â
  public circle3(double r) {
    radius = r;
  }
Â
  public void setRadius(double r) {
    radius = r;
  }
Â
  public double getRadius() {
    return radius;
  }
Â
  public double getArea() {
  double area = Math.PI * (radius * radius);
   return area;
  }
Â
  Â
  public double getDiameter() {
    return radius * 2;
  }
Â
  public double getCircumference() {
    return 2 * PI * radius;
  }
}
----------- Â ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly