I keep getting this error message Assignment1.java:17: error: ';' expected int Rectangle box= new Rectangle(); ^ Assignment1.java:28: error: ';' expected int Circle circleObject = new Circle(); ^ on...


I keep getting this error message


Assignment1.java:17: error: ';' expected
 int Rectangle box= new Rectangle();
                      ^
Assignment1.java:28: error: ';' expected
      int Circle circleObject = new Circle();
                    ^


on my code. Im including the entire code for all 3 classes. (1&2) as picture



 5 public class Circle {
 6

 7    private double diameter;
 8

 9    // Accessor/getter method for diameter
10    public double getDiameter()

11    {
12       return this.diameter;
13    }
14

15    // Mutator/setter method for diameter
16    public void setDiameter(double diameter)

17    {
18       this.diameter = diameter;
19    }
20

21    // Method for calculating the area of the circle
22    public double getArea()

23    {
24       return Math.PI * Math.pow((diameter/2.0), 2.0);
25    }
26

27    // Method for calculating the circumference of the circle
28    public double getCircumference()

29    {
30       return Math.PI *2*(diameter/2.0);
31    }
32 }


public class Assignment1<br>{<br>public static void main(String[] args)<br>{<br>// Create a Rectangle object and assign its<br>// address to the box variable.<br>int Rectangle box= new Rectangle();<br>// Set the box object's length and width.<br>box.setLength(10.0);<br>box.setWidth(5.0);<br>// Display the length and width.<br>System.out.println(

Extracted text: public class Assignment1 { public static void main(String[] args) { // Create a Rectangle object and assign its // address to the box variable. int Rectangle box= new Rectangle(); // Set the box object's length and width. box.setLength(10.0); box.setWidth(5.0); // Display the length and width. System.out.println("The length of the rectangle is System.out.println("The width of the rectangle is + box.setLength(10.0)); + box.setWidth(5.0)); %3D %3D // create a Circle object int Circle circleObject = new Circle(); // set the diamater of the circle circleobject.getDiameter(10.0); // calculate the area and display on the console System.out.println("The area of the circle is " + circleobject.getArea ()); // calculate the circumference and display on the console System.out.println("The circumference of the circle is + circleobject.getCircumference()); // Indicate we are done. System.out.println("Done.");
public_class Rectangle<br>{<br>private double length;<br>private double width;<br>// Accessor/getter method for length<br>public double getLength( )<br>{<br>return length;<br>}<br>// Accessor/getter method for width<br>public double getWidth()<br>{<br>return width;<br>}<br>// Mutator/setter method for length<br>public void setLength(double len)<br>{<br>if (len <= 0.0) {}<br>length<br>}<br>= len;<br>// Mutator/setter method for width<br>public void setWidth(double wid)<br>{<br>width = wid;<br>}<br>// Method for calculating the area of the rectangle<br>public double getArea()<br>{<br>return width*length;<br>}<br>// Method for calculating the perimeter of the rectangle<br>public double getPerimeter()<br>{<br>return 2 * (length + width);<br>}<br>}<br>

Extracted text: public_class Rectangle { private double length; private double width; // Accessor/getter method for length public double getLength( ) { return length; } // Accessor/getter method for width public double getWidth() { return width; } // Mutator/setter method for length public void setLength(double len) { if (len <= 0.0) {} length } = len; // mutator/setter method for width public void setwidth(double wid) { width = wid; } // method for calculating the area of the rectangle public double getarea() { return width*length; } // method for calculating the perimeter of the rectangle public double getperimeter() { return 2 * (length + width); } } 0.0)="" {}="" length="" }="len;" mutator/setter="" method="" for="" width="" public="" void="" setwidth(double="" wid)="" {="" width="wid;" }="" method="" for="" calculating="" the="" area="" of="" the="" rectangle="" public="" double="" getarea()="" {="" return="" width*length;="" }="" method="" for="" calculating="" the="" perimeter="" of="" the="" rectangle="" public="" double="" getperimeter()="" {="" return="" 2="" *="" (length="" +="" width);="" }="">
Jun 04, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here